home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / statusLine.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  83.7 KB  |  2,854 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  26 Feb 1996
  22. //
  23. //  Description:
  24. //      This procedure creates the status line.
  25. //
  26. //  Input Arguments:
  27. //      The parent control that the status line will be created in.
  28. //
  29. //  Return Value:
  30. //      The name of the top layout created.
  31. //        Used for embedding the status line within another layout.
  32. //
  33.  
  34. ////////////////////////////////////////////////////////////////
  35. //  Expand/collapse procedures section
  36. ///////////////////////////////////////////////////////////////
  37.  
  38. global proc toggleFileIcons (int $arg)
  39. //
  40. // Show and Hide the file icons
  41. // $arg=1 means show, 0 means hide, -1 means use optionVar
  42. //
  43. {
  44.     global string $gStatusLine;
  45.     setParent $gStatusLine;
  46.  
  47.     int $state = $arg;
  48.     if ($state < 0) $state = (!`optionVar -q showStatusFiles`);
  49.     
  50.     int $edging = 2;
  51.     if ($state) {
  52.         iconTextButton -edit -manage true newSceneButton;
  53.         iconTextButton -edit -manage true openSceneButton;
  54.         iconTextButton -edit -manage true saveSceneButton;
  55.         formLayout -e 
  56.             -ac selectionSetCollapse left $edging saveSceneButton
  57.             $gStatusLine;
  58.  
  59.         iconTextButton -edit -i1 openBar.xpm fileCollapse;
  60.     } else {
  61.         iconTextButton -edit -manage false newSceneButton;
  62.         iconTextButton -edit -manage false openSceneButton;
  63.         iconTextButton -edit -manage false saveSceneButton;
  64.         formLayout -e 
  65.             -ac selectionSetCollapse left $edging fileCollapse
  66.             $gStatusLine;
  67.  
  68.         iconTextButton -edit -i1 closeBar.xpm fileCollapse;
  69.     }
  70.     optionVar -intValue "showStatusFiles" $state;
  71. }
  72.  
  73. global proc toggleSnapIcons (int $arg)
  74. //
  75. // Show and Hide the snapping icons
  76. // $arg=1 means show, 0 means hide, -1 means use optionVar
  77. //
  78. {
  79.     global string $gStatusLine;
  80.     setParent $gStatusLine;
  81.  
  82.     int $state = $arg;
  83.     if ($state < 0) $state = (!`optionVar -q showStatusSnap`);
  84.     
  85.     int $edging = 2;
  86.     if ($state) {
  87.         formLayout -edit -manage true snapIcons;
  88.         formLayout -e 
  89.             -ac historyCollapse left $edging snapIcons
  90.             $gStatusLine;
  91.  
  92.         iconTextButton -edit -i1 openBar.xpm snapCollapse;
  93.     } else {
  94.         formLayout -edit -manage false snapIcons;
  95.         formLayout -e 
  96.             -ac historyCollapse left $edging snapCollapse
  97.             $gStatusLine;
  98.  
  99.         iconTextButton -edit -i1 closeBar.xpm snapCollapse;
  100.     }
  101.     optionVar -intValue "showStatusSnap" $state;
  102. }
  103.  
  104. global proc toggleRenderIcons (int $arg)
  105. //
  106. // Show and Hide the rendering icons
  107. // $arg=1 means show, 0 means hide, -1 means use optionVar
  108. //
  109. {
  110.     global string $gStatusLine;
  111.     setParent $gStatusLine;
  112.  
  113.     int $state = $arg;
  114.     if ($state < 0) $state = (!`optionVar -q showStatusRender`);
  115.     
  116.     int $edging = 2;
  117.     if ($state) {
  118.         iconTextButton -edit -manage true renderButton;
  119.         iconTextButton -edit -manage true iprRenderButton;
  120.         iconTextButton -edit -manage true renderGlobalsButton;
  121.         formLayout -e 
  122.             -ac inputFieldCollapse left $edging renderGlobalsButton
  123.             $gStatusLine;
  124.  
  125.         iconTextButton -edit -i1 openBar.xpm renderCollapse;
  126.  
  127.     } else {
  128.         iconTextButton -edit -manage false renderButton;
  129.         iconTextButton -edit -manage false iprRenderButton;
  130.         iconTextButton -edit -manage false renderGlobalsButton;
  131.         formLayout -e 
  132.             -ac inputFieldCollapse left $edging renderCollapse
  133.             $gStatusLine;
  134.         iconTextButton -edit -i1 closeBar.xpm renderCollapse;
  135.     }
  136.     optionVar -intValue "showStatusRender" $state;
  137. }
  138.  
  139. global proc toggleInputField (int $arg)
  140. //
  141. // Show and Hide the input field
  142. // $arg=1 means show, 0 means hide, -1 means use optionVar
  143. //
  144. {
  145.     global string $gNumericalInputField;
  146.     global string $gStatusLine;
  147.     setParent $gStatusLine;
  148.  
  149.     int $state = $arg;
  150.     if ($state < 0) $state = (!`optionVar -q showStatusInputField`);
  151.     
  152.     int $edging = 2;
  153.     if ($state) {
  154.         iconTextButton -edit -manage true statusFieldButton;
  155.         textField -edit -manage true $gNumericalInputField;
  156.         iconTextButton -edit -i1 openBar.xpm inputFieldCollapse;
  157.  
  158.     } else {
  159.         iconTextButton -edit -manage false statusFieldButton;
  160.         textField -edit -manage false $gNumericalInputField;
  161.         iconTextButton -edit -i1 closeBar.xpm inputFieldCollapse;
  162.     }
  163.     optionVar -intValue "showStatusInputField" $state;
  164. }
  165.  
  166. global proc toggleHistoryIcons (int $arg)
  167. //
  168. // Show and Hide the history icons
  169. // $arg=1 means show, 0 means hide, -1 means use optionVar
  170. //
  171. {
  172.     global string $gStatusLine;
  173.     setParent $gStatusLine;
  174.  
  175.     int $state = $arg;
  176.     if ($state < 0) $state = (!`optionVar -q showStatusHistory`);
  177.     
  178.     int $edging = 2;
  179.     if ($state) {
  180.         formLayout -edit -manage true historyLayout;
  181.         formLayout -e 
  182.             -ac renderCollapse left $edging historyLayout
  183.             $gStatusLine;
  184.  
  185.         iconTextButton -edit -i1 openBar.xpm historyCollapse;
  186.  
  187.     } else {
  188.         formLayout -edit -manage false historyLayout;
  189.         formLayout -e 
  190.             -ac renderCollapse left $edging historyCollapse
  191.             $gStatusLine;
  192.         iconTextButton -edit -i1 closeBar.xpm historyCollapse;
  193.     }
  194.     optionVar -intValue "showStatusHistory" $state;
  195. }
  196.  
  197. global proc toggleSelectionSetIcons (int $arg)
  198. //
  199. // Show and Hide the selection set icons
  200. // $arg=1 means show, 0 means hide, -1 means use optionVar
  201. //
  202. {
  203.     global string $gStatusLine;
  204.     setParent $gStatusLine;
  205.  
  206.     int $state = $arg;
  207.     if ($state < 0) $state = (!`optionVar -q showStatusSelectionSet`);
  208.     
  209.     int $edging = 2;
  210.     if ($state) {
  211.         formLayout -edit -manage true presetForm;
  212.         formLayout -e 
  213.             -ac selectModeCollapse left $edging presetForm
  214.             $gStatusLine;
  215.  
  216.         iconTextButton -edit -i1 openBar.xpm  selectionSetCollapse;
  217.     } else {
  218.         formLayout -edit -manage false presetForm;
  219.         formLayout -e 
  220.             -ac selectModeCollapse left $edging selectionSetCollapse
  221.             $gStatusLine;
  222.  
  223.         iconTextButton -edit -i1 closeBar.xpm  selectionSetCollapse;
  224.     }
  225.     optionVar -intValue "showStatusSelectionSet" $state;
  226. }
  227.  
  228. global proc toggleSelectModeIcons (int $arg)
  229. //
  230. // Show and Hide the select mode icons
  231. // $arg=1 means show, 0 means hide, -1 means use optionVar
  232. //
  233. {
  234.     global string $gStatusLine;
  235.     setParent $gStatusLine;
  236.  
  237.     int $state = $arg;
  238.     if ($state < 0) $state = (!`optionVar -q showStatusSelectMode`);
  239.     
  240.     int $edging = 2;
  241.     if ($state) {
  242.         formLayout -edit -manage true masksForm;
  243.         formLayout -e 
  244.             -ac selectMasksCollapse left $edging masksForm
  245.             $gStatusLine;
  246.  
  247.         iconTextButton -edit -i1 openBar.xpm  selectModeCollapse;
  248.     } else {
  249.         formLayout -edit -manage false masksForm;
  250.  
  251.         formLayout -e 
  252.             -ac selectMasksCollapse left $edging selectModeCollapse
  253.             $gStatusLine;
  254.  
  255.         iconTextButton -edit -i1 closeBar.xpm  selectModeCollapse;
  256.     }
  257.     optionVar -intValue "showStatusSelectMode" $state;
  258. }
  259.  
  260. global proc toggleSelectMaskIcons (int $arg)
  261. //
  262. // Show and Hide the select options icons
  263. // $arg=1 means show, 0 means hide, -1 means use optionVar
  264. //
  265. {
  266.     global string $gStatusLine;
  267.     setParent $gStatusLine;
  268.  
  269.     int $state = $arg;
  270.     if ($state < 0) $state = (!`optionVar -q showStatusSelectMasks`);
  271.     
  272.     int $edging = 2;
  273.     if ($state) {
  274.         formLayout -edit -manage true selectMaskForm;
  275.         iconTextCheckBox -edit -manage true lockSelectionIcon;
  276.         iconTextCheckBox -edit -manage true highlightSelectIcon;
  277.  
  278.         formLayout -e 
  279.             -ac snapCollapse left $edging highlightSelectIcon
  280.             $gStatusLine;
  281.  
  282.         iconTextButton -edit -i1 openBar.xpm  selectMasksCollapse;
  283.     } else {
  284.         formLayout -edit -manage false selectMaskForm;
  285.         iconTextCheckBox -edit -manage false lockSelectionIcon;
  286.         iconTextCheckBox -edit -manage false highlightSelectIcon;
  287.  
  288.         formLayout -e 
  289.             -ac snapCollapse left $edging selectMasksCollapse
  290.             $gStatusLine;
  291.  
  292.         iconTextButton -edit -i1 closeBar.xpm  selectMasksCollapse;
  293.     }
  294.     optionVar -intValue "showStatusSelectMasks" $state;
  295. }
  296.  
  297. ////////////////////////////////////////////////////////////////
  298. //  Update procedures section
  299. ///////////////////////////////////////////////////////////////
  300.         
  301. global proc updateLockSelectionIcon( )
  302. //
  303. // Toggles the state of the locked selection icon,
  304. // and the state of -xformNoSelect
  305. {
  306.     if( `selectPref -q -xformNoSelect` == 0)
  307.     { 
  308.         selectPref -xformNoSelect 1; 
  309.         iconTextCheckBox -e
  310.             -v 1
  311.             -ann "Unlock current selection"
  312.             lockSelectionIcon;
  313.     } else {
  314.         selectPref -xformNoSelect 0; 
  315.         iconTextCheckBox -e
  316.             -v 0
  317.             -ann "Lock current selection"
  318.             lockSelectionIcon;
  319.     }
  320. }
  321.  
  322.  
  323. global proc toggleHighlightSelectIcon()
  324. {
  325.     int $newState = !`selectPref -q -allowHiliteSelection`;
  326.     selectPref -allowHiliteSelection $newState; 
  327.     updateHighlightSelectIcon;
  328. }
  329.  
  330. global proc updateHighlightSelectIcon()
  331. {
  332.     int $currentState = `selectPref -q -allowHiliteSelection`;
  333.     
  334.     if ($currentState == 0) {
  335.         // Highlight select is off, so push the button in
  336.         iconTextCheckBox -e -v 1
  337.             -ann "Highlight Selection mode is off (Affects component selection mode)"
  338.             -i1 "highlightSelectOff.xpm"
  339.             highlightSelectIcon;
  340.     } else {
  341.         // Highlight select is on, so push the button out
  342.         iconTextCheckBox -e -v 0
  343.             -ann "Highlight Selection mode is on"
  344.             -i1 "highlightSelectOn.xpm"
  345.             highlightSelectIcon;
  346.     }
  347. }
  348.  
  349. // Adds a close button to a window.
  350. //
  351. global proc addCloseButton( string $windowName, string $formLayout, string $tabLayout )
  352. {
  353.     setParent $formLayout;
  354.  
  355.     // Create the close button
  356.     //
  357.     string $attach = `separator -style "in"`;
  358.     button -width 80 -label "Close" -align "center" closeButton;
  359.     button -edit -command ("deleteUI -window " + $windowName) closeButton;
  360.  
  361.     // Align it to the form properly
  362.     //
  363.     formLayout -edit
  364.         -attachForm $tabLayout "top" 0 
  365.         -attachForm $tabLayout "left" 5 
  366.         -attachForm $tabLayout "right" 5 
  367.         -attachControl $tabLayout "bottom" 5 $attach
  368.  
  369.         -attachControl $attach "bottom" 5 closeButton
  370.         -attachForm $attach "left" 5 
  371.         -attachForm $attach "right" 5 
  372.         -attachNone $attach "top"
  373.  
  374.         -attachForm closeButton "bottom" 5
  375.         -attachNone closeButton "top"
  376.         -attachNone closeButton "left"
  377.         -attachPosition closeButton "right" 3 62
  378.         $formLayout;
  379.  
  380. }
  381.  
  382.  
  383. global proc setEditMode( )
  384. //
  385. // Sets the edit mode when the tabs on the selection mask window
  386. // are clicked on.
  387. {
  388.     string $currentTab = `tabLayout -q -st maskTabContainer`;
  389.     if( $currentTab == "objMaskFrame" )
  390.     {
  391.         setSelectMode("objects", "Objects");
  392.     }
  393.     else {
  394.         setSelectMode("components", "Components");
  395.     }
  396. }
  397.  
  398. global proc changeSelectMode( string $mode )
  399. {
  400.     switch( $mode ) {
  401.         case "-hierarchical":
  402.             iconTextCheckBox -e -v 1 selectButton1;
  403.             iconTextCheckBox -e -v 0 selectButton2;
  404.             iconTextCheckBox -e -v 0 selectButton3;
  405.             setSelectMode("hierarchy", "Hierarchy");
  406.             break;
  407.         case "-object":
  408.             iconTextCheckBox -e -v 0 selectButton1;
  409.             iconTextCheckBox -e -v 1 selectButton2;
  410.             iconTextCheckBox -e -v 0 selectButton3;
  411.             setSelectMode("objects", "Objects");
  412.             break;
  413.         case "-component":
  414.             iconTextCheckBox -e -v 0 selectButton1;
  415.             iconTextCheckBox -e -v 0 selectButton2;
  416.             iconTextCheckBox -e -v 1 selectButton3;
  417.             setSelectMode("components", "Components");
  418.             break;
  419.     }
  420.  
  421. }
  422.  
  423. global proc setHierSelectMode( string $mode )
  424. {
  425.     if ( ! `selectMode -q $mode` ) {
  426.         selectMode $mode;
  427.     }
  428.     else {
  429.         switch( $mode ) {
  430.             case "-root":
  431.                 iconTextCheckBox -e -v 1 hierRootButton;
  432.                 break;
  433.             case "-leaf":
  434.                 iconTextCheckBox -e -v 1 hierLeafButton;
  435.                 break;
  436.             case "-template":
  437.                 iconTextCheckBox -e -v 1 hierTemplateButton;
  438.                 break;
  439.     //        case "-preset":
  440.     //            iconTextCheckBox -e -v 1 comboModelingButton;
  441.         }
  442.     }
  443. }
  444.  
  445.  
  446. global proc updateSelectionIcons( string $selectMode )
  447. //
  448. // Handles updating the selection mode icons in the
  449. // status line.
  450. {
  451.     switch( $selectMode ) {
  452.     case "-byHierarchy":
  453.  
  454.         int $isRoot = `selectMode -q -root`;
  455.         int $isLeaf = `selectMode -q -leaf`;
  456.         int $isTemplate = `selectMode -q -template`;
  457. //        int $isBranch = `selectMode -q -branch`;
  458. //        iconTextCheckBox -e -v $isBranch hierBranchButton;
  459.         iconTextCheckBox -e -v $isRoot hierRootButton;
  460.         iconTextCheckBox -e -v $isLeaf hierLeafButton;
  461.         iconTextCheckBox -e -v $isTemplate hierTemplateButton;
  462.  
  463.         // Make sure that only the select by
  464.         // hierarchy button is on.
  465.         //
  466.         iconTextCheckBox -e -v 1 selectButton1;
  467.         iconTextCheckBox -e -v 0 selectButton2;
  468.         iconTextCheckBox -e -v 0 selectButton3;
  469.  
  470.         formLayout -e -manage 1 hierarchyIcons;
  471.         formLayout -e -manage 0 objectMaskIcons;
  472.         formLayout -e -manage 0 componentMaskIcons;
  473.         text        -e -manage 0 comboSelectText;
  474.         // textField -e -tx "Hierarchy" maskField;
  475.  
  476.         break;
  477.  
  478.     case "-byObjectType":
  479.         
  480.         // Make sure that the select by object type
  481.         // button only is on.
  482.         //
  483.         iconTextCheckBox -e -v 0 selectButton1;
  484.         iconTextCheckBox -e -v 1 selectButton2;
  485.         iconTextCheckBox -e -v 0 selectButton3;
  486.  
  487.         //
  488.         // Flip the visibility of the object
  489.         // and component mask icons
  490.         //
  491.         formLayout -e -manage 0 hierarchyIcons;
  492.         formLayout -e -manage 1 objectMaskIcons;
  493.         formLayout -e -manage 0 componentMaskIcons;
  494.         text        -e -manage 0 comboSelectText;
  495.         // textField -e -tx "Objects" maskField;
  496.  
  497.         break;
  498.  
  499.     case "-byCompType":
  500.         
  501.         // Make sure that the select by component
  502.         // type button is the only one on.
  503.         iconTextCheckBox -e -v 0 selectButton1;
  504.         iconTextCheckBox -e -v 0 selectButton2;
  505.         iconTextCheckBox -e -v 1 selectButton3;
  506.  
  507.         //
  508.         // Flip the visibility of the object
  509.         // and component mask icons
  510.         //
  511.         formLayout -e -manage 0 hierarchyIcons;
  512.         formLayout -e -manage 0 objectMaskIcons;
  513.         formLayout -e -manage 1 componentMaskIcons;
  514.         text        -e -manage 0 comboSelectText;
  515.         // textField -e -tx "Components" maskField;
  516.  
  517.         break;
  518.  
  519.     case "-byPreset":
  520.         
  521.         // Make sure that the select by hierarchy
  522.         // type button is the only one on.
  523.         iconTextCheckBox -e -v 0 selectButton1;
  524.         iconTextCheckBox -e -v 1 selectButton2;
  525.         iconTextCheckBox -e -v 1 selectButton3;
  526.  
  527.         //
  528.         // Flip the visibility of the object
  529.         // and component mask icons
  530.         //
  531.         formLayout -e -manage 0 hierarchyIcons;
  532.         formLayout -e -manage 0 objectMaskIcons;
  533.         formLayout -e -manage 0 componentMaskIcons;
  534.         text        -e -manage 1 comboSelectText;
  535.         // textField -e -tx "Mixed" maskField;
  536.  
  537.         break;
  538.     }
  539. }
  540.  
  541. global proc updateSelectionModeIcons()
  542. // This routine is called by a script job when the selection mode changes
  543. {
  544.     if ( `selectMode -q -object` ) {
  545.         updateSelectionIcons -byObjectType;
  546.     }
  547.     else if ( `selectMode -q -component` ) {
  548.         updateSelectionIcons -byCompType;
  549.     }
  550.     else if ( `selectMode -q -hierarchical` ) {
  551.         updateSelectionIcons -byHierarchy;
  552.     }
  553.     else if ( `selectMode -q -preset` ) {
  554.         updateSelectionIcons -byPreset;
  555.     }
  556.  
  557.     string $selectionMode = `getSelectMode`;
  558.     textField -e -tx $selectionMode maskField;
  559. }
  560.  
  561. global proc updateObjectSelectionMasks( )
  562. //
  563. // Handles updating of ALL object selection icons
  564. // in the toolbar.
  565. {
  566.     // Update the selection mask icons on the toolbar- 
  567.     // if any item in the mask is picked, change the 
  568.     // icon to signify that something in that mask is
  569.     // selected - if nothing is picked, turn it
  570.     // off.  If all items are picked, then turn
  571.     // the icon on, and make sure the correct icon
  572.     // is displayed.
  573.  
  574.     // Markers
  575.     //
  576.     int $maskResult = ( `selectType -q -handle` +
  577.                         `selectType -q -ikHandle` );
  578.  
  579.     switch( $maskResult ) {
  580.         case 0:
  581.             // they're all off - turn off the icon, and
  582.             // set the correct icon
  583.             //
  584.             iconTextCheckBox -e -v 0 objButton1;
  585.             iconTextCheckBox -e -i1 "pickHandlesObj.xpm" objButton1;
  586.             break;
  587.         case 2:
  588.             // they're all on - turn the icon on, and
  589.             // set the correct icon
  590.             //
  591.             iconTextCheckBox -e -v 1 objButton1;
  592.             iconTextCheckBox -e -i1 "pickHandlesObj.xpm" objButton1;
  593.             break;
  594.         default:
  595.             // something is on - make sure the icon is
  596.             // on, and set the correct icon
  597.             //
  598.             iconTextCheckBox -e -v 1 objButton1;
  599.             iconTextCheckBox -e -i1 "pickHandlesObjPartial.xpm" objButton1;
  600.             break;
  601.     }
  602.  
  603.     // Joint
  604.     //
  605.     iconTextCheckBox -e -v `selectType -q -joint` objButton2;
  606.  
  607.     // Curves
  608.     //
  609.     int $fullMaskCount = 1;
  610.     $maskResult = `selectType -q -nurbsCurve`;
  611.  
  612.     if (`isTrue MayaCreatorExists` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  613.         $maskResult += `selectType -q -stroke`;
  614.         $fullMaskCount ++;
  615.     }
  616.     if( `isTrue "SurfaceUIExists"` ) {
  617.         $maskResult += `selectType -q -cos`;
  618.         $fullMaskCount ++;
  619.     }
  620.                     
  621.     if( 0 == $maskResult ) {
  622.         // they're all off - turn off the icon, and
  623.         // set the correct icon
  624.         //
  625.         iconTextCheckBox -e -v 0 objButton3;
  626.         iconTextCheckBox -e -i1 "pickCurveObj.xpm" objButton3;
  627.     }
  628.     else if( $fullMaskCount == $maskResult ) {
  629.         // they're all on - turn the icon on, and
  630.         // set the correct icon
  631.         //
  632.         iconTextCheckBox -e -v 1 objButton3;
  633.         iconTextCheckBox -e -i1 "pickCurveObj.xpm" objButton3;
  634.     }
  635.     else {
  636.         // something is on - make sure the icon is
  637.         // on, and set the correct icon
  638.         //
  639.         iconTextCheckBox -e -v 1 objButton3;
  640.         iconTextCheckBox -e -i1 "pickCurveObjPartial.xpm" objButton3;
  641.     }
  642.  
  643.     // Surfaces
  644.     //
  645.     $maskResult = ( `selectType -q -polymesh` +
  646.                     `selectType -q -plane` );
  647.  
  648.     $fullMaskCount = 2;
  649.  
  650.     if ( `isTrue "SurfaceUIExists"` ) {
  651.         $maskResult += `selectType -q -nurbsSurface`;
  652.         $fullMaskCount++;
  653.     }
  654.     if (`isTrue "SubdivUIExists"`) {
  655.         $maskResult += `selectType -q -subdiv`;
  656.         $fullMaskCount++;
  657.     }
  658.  
  659.     if ( $maskResult == 0 ) {
  660.         // they're all off - turn off the icon, and
  661.         // set the correct icon
  662.         //
  663.         iconTextCheckBox -e -v 0 objButton4;
  664.         iconTextCheckBox -e -i1 "pickGeometryObj.xpm" objButton4;
  665.     }
  666.     else if ( $maskResult == $fullMaskCount ) {
  667.         // they're all on - turn the icon on, and
  668.         // set the correct icon
  669.         //
  670.         iconTextCheckBox -e -v 1 objButton4;
  671.         iconTextCheckBox -e -i1 "pickGeometryObj.xpm" objButton4;
  672.     }
  673.     else {
  674.         // something is on - make sure the icon is
  675.         // on, and set the correct icon
  676.         //
  677.         iconTextCheckBox -e -v 1 objButton4;
  678.         iconTextCheckBox -e -i1 "pickGeometryObjPartial.xpm" objButton4;
  679.     }
  680.  
  681.     // Deformations
  682.     //
  683.     $maskResult = ( `selectType -q -lattice` +
  684.                     `selectType -q -cluster` +
  685.                     `selectType -q -sculpt`  +
  686.                     `selectType -q -nonlinear` );    
  687.  
  688.     switch( $maskResult ) {
  689.         case 0:
  690.             // they're all off - turn off the icon, and
  691.             // set the correct icon
  692.             //
  693.             iconTextCheckBox -e -v 0 objButton5;
  694.             iconTextCheckBox -e -i1 "pickDeformerObj.xpm" objButton5;
  695.             break;
  696.         case 4:
  697.             // they're all on - turn the icon on, and
  698.             // set the correct icon
  699.             //
  700.             iconTextCheckBox -e -v 1 objButton5;
  701.             iconTextCheckBox -e -i1 "pickDeformerObj.xpm" objButton5;
  702.             break;
  703.         default:
  704.             // something is on - make sure the icon is
  705.             // on, and set the correct icon
  706.             //
  707.             iconTextCheckBox -e -v 1 objButton5;
  708.             iconTextCheckBox -e -i1 "pickDeformerObjPartial.xpm" objButton5;
  709.             break;
  710.     }
  711.  
  712.     // Dynamics
  713.     //
  714.     // If the user is licensed to use dynamics, set the icons
  715.     // accordingly, otherwise turn them off.
  716.     //
  717.     int $isFluids = fluidEditLicenseFound();
  718.     int $isComplete = `licenseCheck -m edit -type complete`;
  719.  
  720.     if( $isFluids || $isComplete ) {
  721.         int $allOn  = false;
  722.  
  723.         if( $isFluids ) {
  724.             $maskResult = ( `selectType -q -particleShape` +
  725.             `selectType -q -emitter` +
  726.             `selectType -q -field` +
  727.             `selectType -q -fluid` +
  728.             `selectType -q -spring` +
  729.             `selectType -q -rigidBody` +
  730.             `selectType -q -rigidConstraint` );
  731.             $allOn = ($maskResult == 7);
  732.         } else if( $isComplete ) {
  733.             $maskResult = ( `selectType -q -particleShape` +
  734.             `selectType -q -emitter` +
  735.             `selectType -q -field` +
  736.             `selectType -q -spring` +
  737.             `selectType -q -rigidBody` +
  738.             `selectType -q -rigidConstraint` );
  739.             $allOn = ($maskResult == 6);
  740.         }
  741.         
  742.         int $allOff = $maskResult == 0;
  743.  
  744.         // they're all off - turn off the icon, and
  745.         // set the correct icon
  746.         //
  747.         if( $allOff ) {
  748.             iconTextCheckBox -e -v 0 objButton6;
  749.             iconTextCheckBox -e -i1 "pickDynamicsObj.xpm" objButton6;
  750.         } 
  751.         // they're all on - turn the icon on, and
  752.         // set the correct icon
  753.         //
  754.         else if( $allOn ) {
  755.             iconTextCheckBox -e -v 1 objButton6;
  756.             iconTextCheckBox -e -i1 "pickDynamicsObj.xpm" objButton6;
  757.         }
  758.         // something is on - make sure the icon is
  759.         // on, and set the correct icon
  760.         //
  761.         else {
  762.             iconTextCheckBox -e -v 1 objButton6;
  763.             iconTextCheckBox -e -i1 "pickDynamicsObjPartial.xpm" objButton6;
  764.  
  765.         }
  766.     }
  767.     else
  768.     {
  769.         iconTextCheckBox -e -v 0 objButton6;
  770.         iconTextCheckBox -e -i1 "pickDynamicsObj.xpm" objButton6;
  771.     }
  772.  
  773.     // Rendering
  774.     //
  775.     $maskResult = ( `selectType -q -light` +
  776.                     `selectType -q -camera` +
  777.                     `selectType -q -texture` );
  778.  
  779.     switch( $maskResult ) {
  780.         case 0:
  781.             // they're all off - turn off the icon, and
  782.             // set the correct icon
  783.             //
  784.             iconTextCheckBox -e -v 0 objButton7;
  785.             iconTextCheckBox -e -i1 "pickRenderingObj.xpm" objButton7;
  786.             break;
  787.         case 3:
  788.             // they're all on - turn the icon on, and
  789.             // set the correct icon
  790.             //
  791.             iconTextCheckBox -e -v 1 objButton7;
  792.             iconTextCheckBox -e -i1 "pickRenderingObj.xpm" objButton7;
  793.             break;
  794.         default:
  795.             // something is on - make sure the icon is
  796.             // on, and set the correct icon
  797.             //
  798.             iconTextCheckBox -e -v 1 objButton7;
  799.             iconTextCheckBox -e -i1 "pickRenderingObjPartial.xpm" objButton7;
  800.             break;
  801.     }
  802.  
  803.     // Other
  804.     //
  805.     $maskResult = ( `selectType -q -ikEndEffector` +
  806.                     `selectType -q -locator` +
  807.                     `selectType -q -dimension` );
  808.  
  809.     switch( $maskResult ) {
  810.         case 0:
  811.             // they're all off - turn off the icon, and
  812.             // set the correct icon
  813.             //
  814.             iconTextCheckBox -e -v 0 objButton8;
  815.             iconTextCheckBox -e -i1 "pickOtherObj.xpm" objButton8;
  816.             break;
  817.         case 3:
  818.             // they're all on - turn the icon on, and
  819.             // set the correct icon
  820.             //
  821.             iconTextCheckBox -e -v 1 objButton8;
  822.             iconTextCheckBox -e -i1 "pickOtherObj.xpm" objButton8;
  823.             break;
  824.         default:
  825.             // something is on - make sure the icon is
  826.             // on, and set the correct icon
  827.             //
  828.             iconTextCheckBox -e -v 1 objButton8;
  829.             iconTextCheckBox -e -i1 "pickOtherObjPartial.xpm" objButton8;
  830.             break;
  831.     }
  832.     string $selectionMode = `getSelectMode`;
  833.     textField -e -tx $selectionMode maskField;
  834. }
  835.  
  836.  
  837. global proc updateComponentSelectionMasks( )
  838. //
  839. // Handles updating of ALL component selection icons
  840. // in the toolbar.
  841. {
  842.     // Update the selection mask icons - if any
  843.     // item in the mask is picked, change the icon
  844.     // to signify that something in that mask is
  845.     // selected - if nothing is picked, turn it
  846.     // off.  If all items are picked, then turn
  847.     // the icon on, and make sure the correct icon
  848.     // is displayed.
  849.  
  850.     // Points
  851.     //
  852.     int $maskResult = ( `selectType -q -cv` +
  853.                         `selectType -q -polymeshVertex` +
  854.                         `selectType -q -latticePoint` +
  855.                         `selectType -q -particle`);
  856.  
  857.     int $fullMaskCount = 4;
  858.  
  859.     if( `isTrue "SubdivUIExists"` ) {
  860.         $maskResult += `selectType -q -subdivMeshPoint`;
  861.         $fullMaskCount++;
  862.     }
  863.  
  864.     if ( $maskResult == 0 ) {
  865.         // they're all off - turn off the icon, and
  866.         // set the correct icon
  867.         //
  868.         iconTextCheckBox -e -v 0 compButton1;
  869.         iconTextCheckBox -e -i1 "pickPointComp2.xpm" compButton1;
  870.     }
  871.     else if ( $maskResult == $fullMaskCount ) {
  872.         // they're all on - turn the icon on, and
  873.         // set the correct icon
  874.         //
  875.         iconTextCheckBox -e -v 1 compButton1;
  876.         iconTextCheckBox -e -i1 "pickPointComp2.xpm" compButton1;
  877.     }
  878.     else {
  879.         // something is on - make sure the icon is
  880.         // on, and set the correct icon
  881.         //
  882.         iconTextCheckBox -e -v 1 compButton1;
  883.         iconTextCheckBox -e -i1 "pickPointComp2Partial.xpm" compButton1;
  884.     }
  885.  
  886.     // Parm Points
  887.     //
  888.     $fullMaskCount = 4;
  889.     int $maskResult = ( `selectType -q -editPoint` +
  890.                         `selectType -q -curveParameterPoint` +
  891.                         `selectType -q -surfaceParameterPoint` +
  892.                         `selectType -q -puv`);
  893.  
  894.     if( `isTrue "SubdivUIExists"` ) {
  895.         $maskResult += `selectType -q -smu`;
  896.         $fullMaskCount++;
  897.     }
  898.  
  899.     if( $maskResult == 0 ) {
  900.             // they're all off - turn off the icon, and
  901.             // set the correct icon
  902.             //
  903.             iconTextCheckBox -e -v 0 compButton2;
  904.             iconTextCheckBox -e -i1 "pickPointComp.xpm" compButton2;
  905.     }
  906.     else if ( $maskResult == $fullMaskCount ) {
  907.             // they're all on - turn the icon on, and
  908.             // set the correct icon
  909.             //
  910.             iconTextCheckBox -e -v 1 compButton2;
  911.             iconTextCheckBox -e -i1 "pickPointComp.xpm" compButton2;
  912.     }
  913.     else {
  914.             // something is on - make sure the icon is
  915.             // on, and set the correct icon
  916.             //
  917.             iconTextCheckBox -e -v 1 compButton2;
  918.             iconTextCheckBox -e -i1 "pickPointCompPartial.xpm" compButton2;
  919.     }
  920.  
  921.     // Lines
  922.     //
  923.     $maskResult = ( `selectType -q -polymeshEdge` +
  924.                     `selectType -q -springComponent`);
  925.  
  926.     $fullMaskCount = 2;
  927.     if ( `isTrue "SurfaceUIExists"` ) {
  928.         $maskResult += `selectType -q -surfaceEdge`;
  929.         $maskResult += `selectType -q -isoparm`;
  930.         $fullMaskCount+=2;
  931.     }
  932.     if( `isTrue "SubdivUIExists"` ) {
  933.         $maskResult += `selectType -q -subdivMeshEdge`;
  934.         $fullMaskCount++;
  935.     }
  936.  
  937.     if ( $maskResult == 0 ) {
  938.         // they're all off - turn off the icon, and
  939.         // set the correct icon
  940.         //
  941.         iconTextCheckBox -e -v 0 compButton3;
  942.         iconTextCheckBox -e -i1 "pickLineComp.xpm" compButton3;
  943.     }
  944.     else if ( $maskResult == $fullMaskCount ) {
  945.         // they're all on - turn the icon on, and
  946.         // set the correct icon
  947.         //
  948.         iconTextCheckBox -e -v 1 compButton3;
  949.         iconTextCheckBox -e -i1 "pickLineComp.xpm" compButton3;
  950.     }
  951.     else {
  952.         // something is on - make sure the icon is
  953.         // on, and set the correct icon
  954.         //
  955.         iconTextCheckBox -e -v 1 compButton3;
  956.         iconTextCheckBox -e -i1 "pickLineCompPartial.xpm" compButton3;
  957.     }
  958.  
  959.     // Faces
  960.     //
  961.     $maskResult = `selectType -q -facet` + `selectType -q -surfaceFace`;
  962.     $fullMaskCount = 2;
  963.  
  964.     if( `isTrue "SubdivUIExists"` ) {
  965.         $maskResult += `selectType -q -subdivMeshFace`;
  966.         $fullMaskCount++;
  967.     }
  968.  
  969.     if ( $maskResult == 0 ) {
  970.         iconTextCheckBox -e -v 0 compButton4;
  971.         iconTextCheckBox -e -i1 "pickFacetComp.xpm" compButton4;
  972.     }
  973.     else if ( $maskResult == $fullMaskCount ) {
  974.         iconTextCheckBox -e -v 1 compButton4;
  975.         iconTextCheckBox -e -i1 "pickFacetComp.xpm" compButton4;
  976.     }
  977.     else {
  978.         iconTextCheckBox -e -v 1 compButton4;
  979.         iconTextCheckBox -e -i1 "pickFacetCompPartial.xpm" compButton4;
  980.     }
  981.  
  982.  
  983.     // Hulls
  984.     //
  985.     iconTextCheckBox -e -v `selectType -q -hull` compButton5;
  986.  
  987.  
  988.     // Pivots
  989.     //
  990.     $maskResult = ( `selectType -q -rotatePivot` +
  991.                     `selectType -q -scalePivot` +
  992.                     `selectType -q -jointPivot` );
  993.  
  994.     switch( $maskResult ) {
  995.         case 0:
  996.             // they're all off - turn off the icon, and
  997.             // set the correct icon
  998.             //
  999.             iconTextCheckBox -e -v 0 compButton6;
  1000.             iconTextCheckBox -e -i1 "pickPivotComp.xpm" compButton6;
  1001.             break;
  1002.         case 3:
  1003.             // they're all on - turn the icon on, and
  1004.             // set the correct icon
  1005.             //
  1006.             iconTextCheckBox -e -v 1 compButton6;
  1007.             iconTextCheckBox -e -i1 "pickPivotComp.xpm" compButton6;
  1008.             break;
  1009.         default:
  1010.             // something is on - make sure the icon is
  1011.             // on, and set the correct icon
  1012.             //
  1013.             iconTextCheckBox -e -v 1 compButton6;
  1014.             iconTextCheckBox -e -i1 "pickPivotCompPartial.xpm" compButton6;
  1015.             break;
  1016.     }
  1017.  
  1018.  
  1019.     // Markers
  1020.     //
  1021.     iconTextCheckBox -e -v `selectType -q -selectHandle` compButton7;
  1022.  
  1023.  
  1024.     // Other
  1025.     //
  1026.     $maskResult = ( `selectType -q -imagePlane` +
  1027.                     `selectType -q -localRotationAxis` );
  1028.  
  1029.     switch( $maskResult ) {
  1030.         case 0:
  1031.             // they're all off - turn off the icon, and
  1032.             // set the correct icon
  1033.             //
  1034.             iconTextCheckBox -e -v 0 compButton8;
  1035.             iconTextCheckBox -e -i1 "pickOtherComp.xpm" compButton8;
  1036.             break;
  1037.         case 2:
  1038.             // they're all on - turn the icon on, and
  1039.             // set the correct icon
  1040.             //
  1041.             iconTextCheckBox -e -v 1 compButton8;
  1042.             iconTextCheckBox -e -i1 "pickOtherComp.xpm" compButton8;
  1043.             break;
  1044.         default:
  1045.             // something is on - make sure the icon is
  1046.             // on, and set the correct icon
  1047.             //
  1048.             iconTextCheckBox -e -v 1 compButton8;
  1049.             iconTextCheckBox -e -i1 "pickOtherCompPartial.xpm" compButton8;
  1050.             break;
  1051.     }
  1052.     string $selectionMode = `getSelectMode`;
  1053.     textField -e -tx $selectionMode maskField;
  1054. }
  1055.  
  1056. global proc updateSnapMasks ()
  1057. {
  1058.     iconTextCheckBox -e -v `snapMode -q -curve` snapButton1;
  1059.     iconTextCheckBox -e -v `snapMode -q -point` snapButton3;
  1060.     iconTextCheckBox -e -v `snapMode -q -grid` snapButton4;
  1061.     iconTextCheckBox -e -v `snapMode -q -viewPlane` snapButton6;
  1062. }
  1063.  
  1064. global proc updateConstructionHistory()
  1065. {
  1066.     int $val = `constructionHistory -q -toggle`;
  1067.     iconTextCheckBox -e -v $val constructionHistoryButton;
  1068.     if( $val ) {
  1069.         iconTextCheckBox -e -i1 "constructionHistoryOn.xpm"
  1070.             constructionHistoryButton;
  1071.     }
  1072.     else {
  1073.        iconTextCheckBox -e -i1 "constructionHistoryOff.xpm"
  1074.            constructionHistoryButton;
  1075.     }
  1076.  
  1077. }
  1078.  
  1079. global proc createMaskPopup( string $selectionGrp )
  1080. //
  1081. // Creates popup menus on each of the icons in the
  1082. // toolbar, so that users can specify portions of
  1083. // the mask to turn on by selecting the item in
  1084. // the popup menu.  Deletes all items in the popup
  1085. // menu whenever the procedure is called, to make
  1086. // sure that the popups stay in sync with the 
  1087. // current selection mask setting.
  1088. //
  1089. {
  1090.     int $completeLicense = `licenseCheck -m "edit" -typ "complete"`;
  1091.     switch( $selectionGrp ) {
  1092.         //
  1093.         // Objects
  1094.         //
  1095.         case "objMarker":
  1096.             setParent -m ( $selectionGrp + "Popup" );
  1097.  
  1098.             // Delete all items in the menu, and
  1099.             // recreate them to keep the menu in sync
  1100.             // with the current selection settings
  1101.             //
  1102.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1103.  
  1104.             menuItem -l "Selection Handles" 
  1105.                 -cb `selectType -q -handle` 
  1106.                 -c "selectType -handle #1";
  1107.             menuItem -l "IK Handles" 
  1108.                 -cb `selectType -q -ikHandle` 
  1109.                 -c "selectType -ikHandle #1";
  1110.             break;
  1111.  
  1112.         case "objJoint":
  1113.             setParent -m ( $selectionGrp + "Popup" );
  1114.  
  1115.             // Delete all items in the menu, and
  1116.             // recreate them to keep the menu in sync
  1117.             // with the current selection settings
  1118.             //
  1119.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1120.  
  1121.             menuItem -l "Skeleton Joints" 
  1122.                 -cb `selectType -q -joint` 
  1123.                 -c "selectType -joint #1";
  1124.             break;
  1125.  
  1126.         case "objCurve":
  1127.             setParent -m ( $selectionGrp + "Popup" );
  1128.  
  1129.             // Delete all items in the menu, and
  1130.             // recreate them to keep the menu in sync
  1131.             // with the current selection settings
  1132.             //
  1133.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1134.  
  1135.             menuItem -l "NURBS Curves" 
  1136.                 -cb `selectType -q -nurbsCurve` 
  1137.                 -c "selectType -nurbsCurve #1";
  1138.             if( `isTrue "SurfaceUIExists"` ) {
  1139.                 menuItem -l "Curves On Surface" 
  1140.                     -cb `selectType -q -cos` 
  1141.                     -c "selectType -cos #1";
  1142.             }
  1143.             if (`isTrue MayaCreatorExists` && (`licenseCheck -m "edit" -typ "complete"`)) {
  1144.                 menuItem -l "Paint Effects Strokes"  // For Paint Effects
  1145.                     -cb `selectType -q -stroke`  // For Paint Effects
  1146.                     -c "selectType -stroke #1";  // For Paint Effects
  1147.             }
  1148.             break;
  1149.  
  1150.         case "objSurface":
  1151.             setParent -m ( $selectionGrp + "Popup" );
  1152.  
  1153.             // Delete all items in the menu, and
  1154.             // recreate them to keep the menu in sync
  1155.             // with the current selection settings
  1156.             //
  1157.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1158.  
  1159.             if( `isTrue "SurfaceUIExists"` ) {
  1160.                 menuItem -l "NURBS Surfaces" 
  1161.                     -cb `selectType -q -nurbsSurface` 
  1162.                     -c "selectType -nurbsSurface #1";
  1163.             }
  1164.             menuItem -l "Poly Surfaces" 
  1165.                 -cb `selectType -q -polymesh` 
  1166.                 -c "selectType -polymesh #1";
  1167.             if( `isTrue "SubdivUIExists"` ) {
  1168.                 menuItem -l "Subdivision Surfaces" 
  1169.                     -cb `selectType -q -subdiv` 
  1170.                     -c "selectType -subdiv #1";
  1171.             }
  1172.             menuItem -l "Planes" 
  1173.                 -cb `selectType -q -plane` 
  1174.                 -c "selectType -plane #1";
  1175.             break;
  1176.  
  1177.         case "objDeformer":
  1178.             setParent -m ( $selectionGrp + "Popup" );
  1179.  
  1180.             // Delete all items in the menu, and
  1181.             // recreate them to keep the menu in sync
  1182.             // with the current selection settings
  1183.             //
  1184.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1185.  
  1186.             menuItem -l "Lattices" 
  1187.                 -cb `selectType -q -lattice` 
  1188.                 -c "selectType -lattice #1";
  1189.             if ($completeLicense) {            
  1190.                 menuItem -l "Clusters" 
  1191.                     -cb `selectType -q -cluster` 
  1192.                     -c "selectType -cluster #1";
  1193.             }
  1194.             menuItem -l "Nonlinears" 
  1195.                 -cb `selectType -q -nonlinear` 
  1196.                 -c "selectType -nonlinear #1";
  1197.             if ($completeLicense) {
  1198.                 menuItem -l "Sculpt Objects" 
  1199.                     -cb `selectType -q -sculpt` 
  1200.                     -c "selectType -sculpt #1";
  1201.             }
  1202.             break;
  1203.  
  1204.         case "objDynamic":
  1205.             setParent -m ( $selectionGrp + "Popup" );
  1206.  
  1207.             // Delete all items in the menu, and
  1208.             // recreate them to keep the menu in sync
  1209.             // with the current selection settings
  1210.             //
  1211.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1212.  
  1213.             if( `licenseCheck -m edit -type complete` == 1 )
  1214.             {
  1215.                 menuItem -l "Particles" 
  1216.                     -cb `selectType -q -particleShape` 
  1217.                     -c "selectType -particleShape #1";
  1218.                 menuItem -l "Emitters" 
  1219.                     -cb `selectType -q -emitter` 
  1220.                     -c "selectType -emitter #1";
  1221.                 menuItem -l "Fields" 
  1222.                     -cb `selectType -q -field` 
  1223.                     -c "selectType -field #1";
  1224.                 menuItem -l "Springs" 
  1225.                     -cb `selectType -q -spring` 
  1226.                     -c "selectType -spring #1";
  1227.                 menuItem -l "Rigid Bodies"
  1228.                     -cb `selectType -q -rigidBody` 
  1229.                     -c "selectType -rigidBody #1";
  1230.                 menuItem -l "Rigid Constraints" 
  1231.                     -cb `selectType -q -rigidConstraint` 
  1232.                     -c "selectType -rigidConstraint #1";
  1233.             }
  1234.             if( fluidEditLicenseFound() )
  1235.             {
  1236.                 menuItem -l "Fluids" 
  1237.                     -cb `selectType -q -fluid` 
  1238.                     -c "selectType -fluid #1";
  1239.             }
  1240.             break;
  1241.  
  1242.         case "objRendering":
  1243.             setParent -m ( $selectionGrp + "Popup" );
  1244.  
  1245.             // Delete all items in the menu, and
  1246.             // recreate them to keep the menu in sync
  1247.             // with the current selection settings
  1248.             //
  1249.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1250.  
  1251.             menuItem -l "Lights" 
  1252.                 -cb `selectType -q -light` 
  1253.                 -c "selectType -light #1";
  1254.             menuItem -l "Cameras" 
  1255.                 -cb `selectType -q -camera` 
  1256.                 -c "selectType -camera #1";
  1257.             menuItem -l "Textures" 
  1258.                 -cb `selectType -q -texture` 
  1259.                 -c "selectType -texture #1";
  1260.             break;
  1261.  
  1262.         case "objOther":
  1263.             setParent -m ( $selectionGrp + "Popup" );
  1264.  
  1265.             // Delete all items in the menu, and
  1266.             // recreate them to keep the menu in sync
  1267.             // with the current selection settings
  1268.             //
  1269.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1270.  
  1271.             menuItem -l "IK End Effectors" 
  1272.                 -cb `selectType -q -ikEndEffector` 
  1273.                 -c "selectType -ikEndEffector #1";
  1274.             menuItem -l "Locators" 
  1275.                 -cb `selectType -q -locator` 
  1276.                 -c "selectType -locator #1";
  1277.             menuItem -l "Dimensions" 
  1278.                 -cb `selectType -q -dimension` 
  1279.                 -c "selectType -dimension #1";
  1280.             break;
  1281.  
  1282.         //
  1283.         // Components
  1284.         //
  1285.         case "compPoint":
  1286.             setParent -m ( $selectionGrp + "Popup" );
  1287.  
  1288.             // Delete all items in the menu, and
  1289.             // recreate them to keep the menu in sync
  1290.             // with the current selection settings
  1291.             //
  1292.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1293.  
  1294.             menuItem -l "NURBS CVs" 
  1295.                 -cb `selectType -q -cv` 
  1296.                 -c "selectType -cv #1";
  1297.             menuItem -l "Poly Vertices" 
  1298.                 -cb `selectType -q -polymeshVertex` 
  1299.                 -c "selectType -polymeshVertex #1";
  1300.             if( `isTrue "SubdivUIExists"` ) {
  1301.                 menuItem -l "Subdiv Vertices" 
  1302.                     -cb `selectType -q -subdivMeshPoint` 
  1303.                     -c "selectType -subdivMeshPoint #1";
  1304.             }
  1305.             menuItem -l "Lattice Points" 
  1306.                 -cb `selectType -q -latticePoint` 
  1307.                 -c "selectType -latticePoint #1";
  1308.             if( `licenseCheck -m edit -type complete` == 1 )
  1309.             {
  1310.                 menuItem -l "Particles"
  1311.                     -cb `selectType -q -particle` 
  1312.                     -c "selectType -particle #1";
  1313.             }
  1314.             break;
  1315.  
  1316.         case "compParmPoint":
  1317.             setParent -m ( $selectionGrp + "Popup" );
  1318.  
  1319.             // Delete all items in the menu, and
  1320.             // recreate them to keep the menu in sync
  1321.             // with the current selection settings
  1322.             //
  1323.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1324.  
  1325.             menuItem -l "NURBS Edit Points" 
  1326.                 -cb `selectType -q -editPoint` 
  1327.                 -c "selectType -editPoint #1";
  1328.             menuItem -l "NURBS Curve Points" 
  1329.                 -cb `selectType -q -cpp` 
  1330.                 -c "selectType -cpp #1";
  1331.             menuItem -l "NURBS Surface Points" 
  1332.                 -cb `selectType -q -spp` 
  1333.                 -c "selectType -spp #1";
  1334.             menuItem -l "Poly UVs" 
  1335.                 -cb `selectType -q -puv` 
  1336.                 -c "selectType -puv #1";
  1337.             if( `isTrue "SubdivUIExists"` ) {
  1338.                 menuItem -l "Subdiv UVs" 
  1339.                     -cb `selectType -q -subdivMeshUV` 
  1340.                     -c "selectType -subdivMeshUV #1";
  1341.             }
  1342.             break;
  1343.  
  1344.         case "compLine":
  1345.             setParent -m ( $selectionGrp + "Popup" );
  1346.  
  1347.             // Delete all items in the menu, and
  1348.             // recreate them to keep the menu in sync
  1349.             // with the current selection settings
  1350.             //
  1351.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1352.  
  1353.             if( `isTrue "SurfaceUIExists"` ) {
  1354.                 menuItem -l "NURBS Isoparms" 
  1355.                     -cb `selectType -q -isoparm` 
  1356.                     -c "selectType -isoparm #1";
  1357.                 menuItem -l "NURBS Trim Edges" 
  1358.                     -cb `selectType -q -surfaceEdge` 
  1359.                     -c "selectType -surfaceEdge #1";
  1360.             }
  1361.             menuItem -l "Poly Edges" 
  1362.                 -cb `selectType -q -polymeshEdge` 
  1363.                 -c "selectType -polymeshEdge #1";
  1364.             if( `isTrue "SubdivUIExists"` ) {
  1365.                 menuItem -l "Subdiv Edges" 
  1366.                     -cb `selectType -q -subdivMeshEdge` 
  1367.                     -c "selectType -subdivMeshEdge #1";
  1368.             }
  1369.             if( `licenseCheck -m edit -type complete` == 1 )
  1370.             {
  1371.                 menuItem -l "Springs"
  1372.                     -cb `selectType -q -springComponent` 
  1373.                     -c "selectType -springComponent #1";
  1374.             }
  1375.             break;
  1376.  
  1377.         case "compFacet":
  1378.             setParent -m ( $selectionGrp + "Popup" );
  1379.  
  1380.             // Delete all items in the menu, and
  1381.             // recreate them to keep the menu in sync
  1382.             // with the current selection settings
  1383.             //
  1384.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1385.  
  1386.             if( `isTrue "SurfaceUIExists"` ) {
  1387.                 menuItem -l "NURBS Patches" 
  1388.                     -cb `selectType -q -surfaceFace` 
  1389.                     -c "selectType -surfaceFace #1";
  1390.             }
  1391.             menuItem -l "Poly Faces" 
  1392.                 -cb `selectType -q -facet` 
  1393.                 -c "selectType -facet #1";
  1394.             if( `isTrue "SubdivUIExists"` ) {
  1395.                 menuItem -l "Subdiv Faces" 
  1396.                     -cb `selectType -q -subdivMeshFace` 
  1397.                     -c "selectType -subdivMeshFace #1";
  1398.             }
  1399.             break;
  1400.  
  1401.         case "compHull":
  1402.             setParent -m ( $selectionGrp + "Popup" );
  1403.  
  1404.             // Delete all items in the menu, and
  1405.             // recreate them to keep the menu in sync
  1406.             // with the current selection settings
  1407.             //
  1408.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1409.  
  1410.             menuItem -l "NURBS Hulls" 
  1411.                 -cb `selectType -q -hull` 
  1412.                 -c "selectType -hull #1";
  1413.             break;
  1414.  
  1415.         case "compPivot":
  1416.             setParent -m ( $selectionGrp + "Popup" );
  1417.  
  1418.             // Delete all items in the menu, and
  1419.             // recreate them to keep the menu in sync
  1420.             // with the current selection settings
  1421.             //
  1422.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1423.  
  1424.             menuItem -l "Rotate Pivots" 
  1425.                 -cb `selectType -q -rotatePivot` 
  1426.                 -c "selectType -rotatePivot #1";
  1427.             menuItem -l "Scale Pivots" 
  1428.                 -cb `selectType -q -scalePivot` 
  1429.                 -c "selectType -scalePivot #1";
  1430.             menuItem -l "Joint Pivots" 
  1431.                 -cb `selectType -q -jointPivot` 
  1432.                 -c "selectType -jointPivot #1";
  1433.             break;
  1434.  
  1435.         case "compMarker":
  1436.             setParent -m ( $selectionGrp + "Popup" );
  1437.  
  1438.             // Delete all items in the menu, and
  1439.             // recreate them to keep the menu in sync
  1440.             // with the current selection settings
  1441.             //
  1442.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1443.  
  1444.             menuItem -l "Selection Handles" 
  1445.                 -cb `selectType -q -selectHandle` 
  1446.                 -c "selectType -selectHandle #1";
  1447.  
  1448.             break;
  1449.  
  1450.         case "compOther":
  1451.             setParent -m ( $selectionGrp + "Popup" );
  1452.  
  1453.             // Delete all items in the menu, and
  1454.             // recreate them to keep the menu in sync
  1455.             // with the current selection settings
  1456.             //
  1457.             popupMenu -e -dai ( $selectionGrp + "Popup" );
  1458.  
  1459.             menuItem -l "Local Rotation Axes" 
  1460.                 -cb `selectType -q -localRotationAxis` 
  1461.                 -c "selectType -localRotationAxis #1";
  1462.             menuItem -l "Image Planes" 
  1463.                 -cb `selectType -q -imagePlane` 
  1464.                 -c "selectType -imagePlane #1";
  1465.             break;
  1466.     }
  1467. }
  1468.  
  1469.  
  1470.  
  1471. global proc workingMode( string $mode )
  1472. //
  1473. // Changes Maya into various 'working modes', like
  1474. // all, where the user has access to all tools in
  1475. // the tool palette, tool popups, etc, to things like
  1476. // animation mode, where tool choices are more limited,
  1477. // selection weighting is switched around, etc..
  1478. //
  1479. {
  1480.     if( `licenseCheck -m edit -type complete` == 0 )
  1481.     {
  1482.         if( $mode == "Dynamics" )
  1483.         {
  1484.             warning("You are not licensed to use the \"Dynamics\" menu set.");
  1485.             //
  1486.             // Since the default mode is "Animation" (see the switch statement
  1487.             // below), we will set the mode to be that if the user chose Dynamics
  1488.             // but is not licensed for it.
  1489.             //
  1490.             $mode = "Animation";
  1491.         }
  1492.     }
  1493.  
  1494.     global string $gMenuModeButton;
  1495.  
  1496.     // Set Maya's new 'working mode' to $mode,
  1497.     // so that ModelEdMenu can check to see if
  1498.     // it should rebuild the main menu next time
  1499.     // it's popped up.
  1500.     // 
  1501.     global string $gMayaMode;
  1502.     $gMayaMode = $mode;
  1503.     //
  1504.     // Set selection priorities to match the mode
  1505.     // the user is working in.
  1506.     //
  1507.     // selPriority $mode;
  1508.     //
  1509.     // Destroy the popup called $controlName + "MainPop"
  1510.     // in order to get them to recreate themselves.
  1511.     //
  1512.     string $modelPanels[] = `getPanel -type modelPanel`;
  1513.  
  1514.     for( $item in $modelPanels )
  1515.     {
  1516.         if (`popupMenu -exists ( $item + "MainPop" )`) {
  1517.             popupMenu -e -dai ( $item + "MainPop" );
  1518.         }
  1519.     }
  1520.  
  1521.     //    Update the working mode
  1522.     //
  1523.     switch( $mode ) {
  1524.         case "Animation":    setMenuMode Animation; syncHotBox Animation; break;
  1525.         case "Modeling":    setMenuMode Modeling; syncHotBox Modeling; break;
  1526.         case "Rendering":    setMenuMode Rendering; syncHotBox Rendering; break;
  1527.         case "Dynamics":    setMenuMode Dynamics; syncHotBox Dynamics; break;
  1528.         case "Cloth":        setMenuMode Cloth; syncHotBox Cloth; break;
  1529.         case "Live":        setMenuMode Live; syncHotBox Live; break;
  1530.         default:            setMenuMode Animation; $mode = "Animation"; syncHotBox Animation; break;
  1531.     }
  1532. }
  1533.  
  1534. global proc updateMenuMode()
  1535. {
  1536.     global string $gMenuModeButton;
  1537.     workingMode(`optionMenu -q -v $gMenuModeButton`);
  1538. }
  1539.  
  1540. global proc statusLineUpdateInputField()
  1541. //
  1542. //    Description:
  1543. //        This procedure updates the value of the input field on the
  1544. //        Status Line.
  1545. //
  1546. //        When the input field is in rename mode then get the name of 
  1547. //        the lead object in the selection list and display it in the 
  1548. //        field.
  1549. //
  1550. //        When the input field is in any other mode then clear the 
  1551. //        field value.
  1552. //
  1553. {
  1554.     global string $gNumericalInputField;
  1555.  
  1556.     //    Determine the mode of the field. Only way to do this is
  1557.     //    to figure out what image is currently applied to the field
  1558.     //    label.
  1559.     //
  1560.     string $image = `iconTextButton -query -image1 statusFieldButton`;
  1561.     string $fieldValue = "";
  1562.     
  1563.     if ("quickRename.xpm" == $image) {
  1564.  
  1565.         //    Update the field with the name of the lead object in the selection.
  1566.         //
  1567.         string $selectionArray[], $tokenBuffer[], $selectedObject;
  1568.         int    $numberOfSelectedObjects, $tokenCount;
  1569.         
  1570.         //    Determine the lead object in the selection.
  1571.         //
  1572.         $selectionArray = `ls -selection -tail 1`;
  1573.         $numberOfSelectedObjects = size($selectionArray);
  1574.         if (0 < $numberOfSelectedObjects) {
  1575.             $selectedObject = $selectionArray[$numberOfSelectedObjects - 1];
  1576.  
  1577.             //    It is possible that the full path to an object may be
  1578.             //    returned even when querying the selection by short names.
  1579.             //    This will happen if the more than one object has the
  1580.             //    same name. The full path won't fit in the rename field
  1581.             //    so strip off the path and display only the short name.
  1582.             //    To do this tokenize the object name by the | character.
  1583.             //    The short name will be the last item in the array
  1584.             //    returned by the tokenize command.
  1585.             //
  1586.             $tokenCount = `tokenize $selectedObject "|" $tokenBuffer`;
  1587.             $fieldValue = $tokenBuffer[$tokenCount - 1];
  1588.  
  1589.         } else {
  1590.             //
  1591.             //    Nothing selected. Clear the field.
  1592.             //
  1593.             $fieldValue = "";
  1594.         }
  1595.  
  1596.     } else {
  1597.         //
  1598.         //    For all the other field modes clear the text.
  1599.         //
  1600.         $fieldValue = "";
  1601.     }
  1602.  
  1603.     //    Update the field.
  1604.     //
  1605.     textField -edit -text $fieldValue $gNumericalInputField;
  1606. }
  1607.  
  1608. global proc quickRename()
  1609. //
  1610. //    Description:
  1611. //        Called from the quick rename field to allow easy renaming of 
  1612. //        the selected objects for users who don't want to have to open 
  1613. //        the Channel Box or Attribute Editor.
  1614. //
  1615. {
  1616.     global string $gNumericalInputField;
  1617.  
  1618.     string $newName;
  1619.     int    $renameResult;
  1620.  
  1621.     //    Get the name in the text field.
  1622.     //
  1623.     $newName = `textField -query -text $gNumericalInputField`;
  1624.  
  1625.     //    The result will contain the number of renamed objects,
  1626.     //    which may be zero if all the objects in the selection
  1627.     //    list are read-only (examples of read-only objects are
  1628.     //    default and referenced objects).
  1629.     //
  1630.     $renameResult = renameSelectionList($newName);
  1631.  
  1632.     if (0 <= $renameResult) {
  1633.         //
  1634.         //    Return focus to the panel that last had focus.
  1635.         //
  1636.         setFocus `getPanel -withFocus`;
  1637.  
  1638.     } else if (-1 == $renameResult) {
  1639.         //
  1640.         //    The selection list is empty. Not serious, just print
  1641.         //    a warning.
  1642.         //
  1643.         warning ("There are no selected objects to rename. Select " 
  1644.             + "one or more objects and re-enter a name.");
  1645.  
  1646.         statusLineUpdateInputField();
  1647.  
  1648.         //    Return focus to the panel that last had focus.
  1649.         //
  1650.         setFocus `getPanel -withFocus`;
  1651.  
  1652.     } else if (-2 == $renameResult) {
  1653.         //
  1654.         //    An invalid name error. Print an error message.
  1655.         //    Don't send focus back to the panels. Keep it in the field
  1656.         //    so the user can correct the error in the field.
  1657.         //
  1658.         error ("\"" + $newName + "\" is not a valid name. Enter a name " +
  1659.             "that begins with a letter or underscore and is followed " +
  1660.             "by letters, digits or underscores.");
  1661.     }
  1662. }
  1663.  
  1664. global proc quickWildcardSelect()
  1665. //
  1666. // Called from the quick select field to allow easy wildcard
  1667. // selection with feedback for users who don't want to have
  1668. // to open the outliner for simple selections.
  1669. //
  1670. {
  1671.     global string $gNumericalInputField;
  1672.  
  1673.     //    Get the text in the select field.
  1674.     //
  1675.     string $text = `textField -query -text $gNumericalInputField`;
  1676.  
  1677.     //    Are there any wildcard characters in the text?
  1678.     //    Wildcard characters are * and ? (are there others?).
  1679.     //
  1680.     int $wildcards = false;
  1681.     if (`gmatch $text "*[\*\?]*"`) {
  1682.         $wildcards = true;
  1683.     }
  1684.  
  1685.     string $cmd;
  1686.  
  1687.     //    If there are no wildcards then do a test to see if the
  1688.     //    name specified in the field uniquely specifies a single
  1689.     //    object in the scene. This can be determined by using
  1690.     //    the "ls" command.
  1691.     //    
  1692.     if (!$wildcards) {
  1693.         string $object, $objectArray[] = `ls $text`;
  1694.         if (1 < size($objectArray)) {
  1695.             //
  1696.             //    There is more than one object with the name specified.
  1697.             //    Be sure to select them all.
  1698.             //
  1699.             $cmd = "select";
  1700.             for ($object in $objectArray) {
  1701.                 $cmd += (" " + $object);
  1702.             }
  1703.  
  1704.         } else {
  1705.             //
  1706.             //    No wildcards and just one object with the specified
  1707.             //    name.
  1708.             //
  1709.             $cmd = ("select \"" + $text + "\"");
  1710.         }
  1711.  
  1712.     } else {
  1713.         $cmd = ("select \"" + $text + "\"");
  1714.     }
  1715.  
  1716.     // If something was actually selected then give some feedback
  1717.     // and clean up.  Otherwise the offending text is left in the
  1718.     // field and focus remains in the field for another try.
  1719.     //
  1720.     if (!catch(eval($cmd))) {
  1721.     
  1722.         //    Give some feedback that something was selected. Query
  1723.         //    what's on the selection list and for each item append
  1724.         //    it to a result string that will be echoed to the user.
  1725.         //
  1726.         string $lsList = "";
  1727.         string $lsArray[] = `ls -sl`;
  1728.         for ($i = 0; $i < size($lsArray); $i++) {
  1729.             $lsList = $lsList+" "+$lsArray[$i];
  1730.         }
  1731.         print ("// Result: "+$lsList+"\n");
  1732.         
  1733.         // Clear the field and throw the focus back to the panels
  1734.         //
  1735.         statusLineUpdateInputField();
  1736.         setFocus `paneLayout -query -pane1 viewPanes`;
  1737.     }
  1738. }
  1739.  
  1740. global proc setQuickFieldMode (string $mode)
  1741. {
  1742.     global string $gNumericalInputField;
  1743.     switch ($mode) {
  1744.         case "Select":
  1745.             iconTextButton -e -i1 "quickSelect.xpm" statusFieldButton; 
  1746.             textField -e 
  1747.                 -ann "Type text with wildcards to select objects"
  1748.                 -cc "quickWildcardSelect" -ec "" 
  1749.                 $gNumericalInputField;
  1750.             break;
  1751.  
  1752.         case "Rename":
  1753.             iconTextButton -e -i1 "quickRename.xpm" statusFieldButton; 
  1754.             textField -edit
  1755.                 -annotation "Rename the selected object(s)"
  1756.                 -changeCommand ("quickRename") -enterCommand ("")
  1757.                 $gNumericalInputField;
  1758.             break;
  1759.  
  1760.         case "Abs":
  1761.             iconTextButton -e -i1 "absolute.xpm" statusFieldButton; 
  1762.             textField -e 
  1763.                 -ann "Absolute values used for current tool"
  1764.                 -cc "numericalInputChangeCommand abs" 
  1765.                 -ec "setFocus $gNumericalInputField" 
  1766.                 $gNumericalInputField;
  1767.             break;
  1768.  
  1769.         case "Rel":
  1770.             iconTextButton -e -i1 "relative.xpm" statusFieldButton; 
  1771.             textField -e 
  1772.                 -ann "Relative values used for current tool"
  1773.                 -cc "numericalInputChangeCommand rel" 
  1774.                 -ec "setFocus $gNumericalInputField" 
  1775.                 $gNumericalInputField;
  1776.             break;
  1777.     }
  1778.  
  1779.     //    When the mode changes update the field. 
  1780.     //
  1781.     statusLineUpdateInputField();
  1782. }
  1783.  
  1784. global proc updateStatusLineRendererSpecificUI()
  1785. {
  1786.     //
  1787.     // Description:
  1788.     //    This procedure is called when the current renderer changes.
  1789.     //    This procedure updates status line UI which behaves differently
  1790.     //    depending on the current renderer.
  1791.     //
  1792.  
  1793.     global string $gStatusLine;
  1794.     string $currentRendererName = currentRenderer();
  1795.     string $renUIName = `renderer -query -rendererUIName $currentRendererName`;
  1796.  
  1797.  
  1798.     if (!`layout -exists $gStatusLine`) return;
  1799.  
  1800.     setParent $gStatusLine;
  1801.  
  1802.     // Change the tool tip associated with the render icon button 
  1803.     // on status line in the main window. 
  1804.     //
  1805.     iconTextButton
  1806.         -edit
  1807.         -annotation 
  1808.             ("Render the current frame (" + $renUIName + ")") 
  1809.         renderButton;
  1810.  
  1811.     // Change the tool tip associated with the render globals icon button 
  1812.     // on status line in the main window. 
  1813.     //
  1814.     iconTextButton
  1815.         -edit
  1816.         -annotation 
  1817.             ("Display Render Globals window (" + $renUIName + ")") 
  1818.         renderGlobalsButton;
  1819.  
  1820.     // Enable/disable the IPR button if it is supported/not supported by the
  1821.     // current renderer.
  1822.     //
  1823.     if (`renderer -query -iprRenderProcedure $currentRendererName` != "")
  1824.     {
  1825.         iconTextButton 
  1826.             -edit 
  1827.             -enable true
  1828.             -annotation 
  1829.                 ("IPR render the current frame (" + $renUIName + ")")
  1830.             iprRenderButton;
  1831.     }
  1832.     else
  1833.     {
  1834.         iconTextButton 
  1835.             -edit 
  1836.             -enable false
  1837.             -annotation ("")
  1838.             iprRenderButton;
  1839.     }
  1840.  
  1841.     setParent ..;
  1842. }
  1843.  
  1844. // Register the procedure responsible for updating all renderer
  1845. // related UI created in the status line.
  1846. //
  1847. registerUpdateRendererUIProc("updateStatusLineRendererSpecificUI");
  1848.  
  1849.  
  1850. //global proc string statusLine ()
  1851. {
  1852.     global string $gStatusLine;
  1853.     global string $gStatusLineForm;
  1854.     global string $gMenuModeButton;
  1855.     global string $gNumericalInputField;
  1856.  
  1857.     int $height = 26;
  1858.     
  1859.     //    New for 4.0 are buttons on the far right of the Status Line that
  1860.     //    control the visibility of the Attribute Editor, Tool Settings, and
  1861.     //    Channel Box / Layer Editor.
  1862.     //
  1863.     //    To do this insert a form layout. The existing $gStatusLineForm will
  1864.     //    be parented to it as well as the form that contains the new buttons.
  1865.     //
  1866.     $statusLine = `formLayout -parent $gStatusLineForm`;
  1867.     $gStatusLine = `formLayout`;
  1868.  
  1869.         // Create the Menubar set switching popup
  1870.         $gMenuModeButton = 
  1871.             `optionMenu 
  1872.                 -annotation "Menu Sets: Select the menus to appear in the Main Menu Bar" 
  1873.                 -cc updateMenuMode menuMode`;
  1874.         menuItem -l "Animation" -enableCommandRepeat false animationMode;
  1875.         menuItem -l "Modeling" -enableCommandRepeat false modelingMode;
  1876.         if( `licenseCheck -m edit -type complete` == 1 )
  1877.         {
  1878.             menuItem -l "Dynamics" -enableCommandRepeat false dynamicsMode;
  1879.         }
  1880.         menuItem -l "Rendering" -enableCommandRepeat false renderingMode;
  1881.  
  1882.  
  1883.         //
  1884.         // set height to height of optionMenu if it is too tall
  1885.         // (this happens with LargeFonts installed on NT
  1886.         //
  1887.         int $h = `control -q -h menuMode`;
  1888.         if ($h > $height) $height = $h;
  1889.         int $iconHeight = 26;
  1890.         int $thinIconWidth = 17;
  1891.  
  1892.         // If the user has either of these turned off then dim the
  1893.         // menu item.
  1894.         if( `licenseCheck -m edit -type complete` == 1 )
  1895.         {
  1896.             if (!`isTrue "DynamicsExists"`) 
  1897.                 menuItem -e -en 0 dynamicsMode;    
  1898.         }
  1899.  
  1900.         if (!`isTrue "RenderingExists"`)
  1901.             menuItem -e -en 0 renderingMode;
  1902.  
  1903.         setParent -m ..;
  1904.  
  1905.         // Create the New/Open/Save buttons 
  1906.         iconTextButton -image1 "fileNew.xpm" 
  1907.             -width ($iconHeight-4) -height $iconHeight     //skinny icon        
  1908.             -command ("NewScene")
  1909.             -annotation "Create a new scene" 
  1910.             newSceneButton;
  1911.  
  1912.         iconTextButton -image1 "fileOpen.xpm"
  1913.             -width $iconHeight -height $iconHeight             
  1914.             -command ("OpenScene")
  1915.             -annotation "Open a scene" 
  1916.             openSceneButton;
  1917.  
  1918.         iconTextButton -image1 "fileSave.xpm"
  1919.             -width $iconHeight -height $iconHeight             
  1920.             -command ("SaveScene")
  1921.             -annotation "Save the current scene" 
  1922.             saveSceneButton;
  1923.  
  1924.         //     Create the selection mask setting widget, that
  1925.         //    allows user to set masks at a high level, or
  1926.         //    define their own
  1927.         //
  1928.         formLayout -height $height presetForm;
  1929.             iconTextStaticLabel 
  1930.                 -w $thinIconWidth -h $iconHeight             
  1931.                 -ann "Set the selection mask"
  1932.                 -i1 "popupMenuIcon.xpm" 
  1933.                 maskMenuIcon;
  1934.             textField 
  1935.                 -annotation "Selection Mode Field: Set the selection mask"
  1936.                 -ed false 
  1937.                 -tx "Root" 
  1938.                 -width 94 
  1939.                 maskField;
  1940.         setParent ..;
  1941.  
  1942.         //    Layout the above form
  1943.         //
  1944.         formLayout -e
  1945.             -af maskMenuIcon left 0
  1946.             -an maskMenuIcon right
  1947.             -af maskMenuIcon bottom 0
  1948.             -af maskMenuIcon top 0
  1949.  
  1950.             -af maskField top 0
  1951.             -ac maskField left 0 maskMenuIcon
  1952.             -af maskField bottom 0
  1953.             -an maskField right
  1954.             presetForm;
  1955.  
  1956.         //  Attach a popup menu that controls the
  1957.         //  contents of the textField, and sets the
  1958.         //  selection masks
  1959.         //
  1960.         string $menu = `popupMenu -b 1 -p presetForm`;
  1961.             menu -e -pmc ( "buildMaskSettingMenu " + $menu ) $menu;
  1962.         setParent -m ..;
  1963.  
  1964.         // Create the icons to specify the selection mode
  1965.         //
  1966.         int $isHierarchy = `selectMode -q -hierarchical`;
  1967.         int $isObject    = `selectMode -q -object`;
  1968.         int $isComponent = `selectMode -q -component`;
  1969.         int $isPreset     = `selectMode -q -preset`;
  1970.  
  1971.         formLayout -manage 1 masksForm;
  1972.             iconTextCheckBox -i1 "pickHierarchy.xpm" 
  1973.                 -w $iconHeight -h $iconHeight
  1974.                 -v ( $isHierarchy || $isPreset )
  1975.                 -cc "changeSelectMode -hierarchical"
  1976.                 -ann "Select by hierarchy and combinations" 
  1977.                 selectButton1;
  1978.             iconTextCheckBox -i1 "pickObjByType.xpm" 
  1979.                 -w $iconHeight -h $iconHeight
  1980.                 -v $isObject
  1981.                 -cc "changeSelectMode -object"
  1982.                 -ann "Select by object type"
  1983.                 selectButton2;
  1984.             iconTextCheckBox -i1 "pickCompByType.xpm" 
  1985.                 -w $iconHeight -h $iconHeight
  1986.                 -v $isComponent
  1987.                 -cc "changeSelectMode -component"
  1988.                 -ann "Select by component type" 
  1989.                 selectButton3;
  1990.         setParent ..;
  1991.  
  1992.         // Layout the icons, by attaching them to themselves
  1993.         // and the formLayout holding the icons
  1994.         //
  1995.         formLayout -e 
  1996.             -af selectButton3 right 0 
  1997.             -ac selectButton2 right 0 selectButton3
  1998.             -ac selectButton1 right 0 selectButton2
  1999.           masksForm;
  2000.  
  2001.         formLayout selectMaskForm;
  2002.         
  2003.         // Create a separator that forces the size of the mask
  2004.         // button to always be the same.
  2005.         separator -w 230 -height 1 -style none selectMaskSeparator; 
  2006.     
  2007.         //    Create the label that says the user is in a combo
  2008.         //    mode
  2009.         text -l "Combination Selection" -manage $isPreset comboSelectText;
  2010.  
  2011.         //    Create the label that says the user is in a combo
  2012.         //    mode
  2013. //        text -l "Hierarchical Selection" -manage $isHierarchy hierSelectText;
  2014.  
  2015.         // Create the icons to specify the hierarchy mode pick mask
  2016.         //
  2017.         formLayout -manage $isHierarchy hierarchyIcons;
  2018.  
  2019.             formLayout hierPickMenuLayout;
  2020.                 iconTextStaticLabel
  2021.                     -w $thinIconWidth -h $iconHeight
  2022.                     -annotation "Set the hierarchy selection mask"
  2023.                     -i1 "popupMenuIcon.xpm" 
  2024.                     hierPickMenuIcon;
  2025.             setParent ..;
  2026.  
  2027.             iconTextCheckBox -i1 "selectObj.xpm" -v 1 
  2028.                 -w $iconHeight -h $iconHeight
  2029.                 -cc "setHierSelectMode -root"
  2030.                 -ann "Select by hierarchy: Root"
  2031.                 hierRootButton;
  2032.             iconTextCheckBox -i1 "selectComp.xpm" -v 0 
  2033.                 -w $iconHeight -h $iconHeight
  2034.                 -cc "setHierSelectMode -leaf"
  2035.                 -ann "Select by hierarchy: Leaf"
  2036.                 hierLeafButton;
  2037.             iconTextCheckBox -i1 "pickTemplate.xpm" -v 0
  2038.                 -w $iconHeight -h $iconHeight
  2039.                 -cc "setHierSelectMode -template"
  2040.                 -ann "Select by hierarchy: Template" 
  2041.                 hierTemplateButton;
  2042. //            iconTextCheckBox -i1 "pickCurveObj.xpm" -v 0
  2043. //                -w $iconHeight -h $iconHeight
  2044. //                -cc "setHierSelectMode -preset"
  2045. //                -ann "Select by combination: Modeling" 
  2046. //                comboModelingButton;
  2047.         setParent ..;
  2048.  
  2049.         // Layout the icons, by attaching them to themselves
  2050.         // and the formLayout holding the icons
  2051.         //
  2052.         formLayout -e 
  2053.             -af hierPickMenuLayout left 0 
  2054.             -ac hierRootButton left 3 hierPickMenuLayout
  2055.             -ac hierLeafButton left 0 hierRootButton
  2056.             -ac hierTemplateButton left 0 hierLeafButton 
  2057.             hierarchyIcons;
  2058.  
  2059.         // Attach a menu to the hierPickMenuLayout
  2060.         //
  2061.         popupMenu -b 1 -p hierPickMenuLayout;
  2062.             menuItem -l "Root"
  2063.                 -c "selectMode -root"
  2064.                 rootPickMenuItem;
  2065.             menuItem -l "Leaf"
  2066.                 -c "selectMode -leaf"
  2067.                 leafPickMenuItem;
  2068.             menuItem -l "Template"
  2069.                 -c "selectMode -template"
  2070.                 templatePickMenuItem;
  2071. //            menuItem -l "Template"
  2072. //                -c "setHierSelectMode -comboModeling"
  2073. //                comboModelingPickMenuItem;
  2074.         setParent -m ..;
  2075.  
  2076.         // Create the icons to specify the object mode pick mask
  2077.         // in a coarser manner than the pick mask menus.
  2078.         //
  2079.         formLayout -manage $isObject objectMaskIcons;
  2080.  
  2081.             formLayout objPickMenuLayout;
  2082.                 iconTextStaticLabel 
  2083.                     -w $thinIconWidth -h $iconHeight            
  2084.                     -annotation "Set the object selection mask"
  2085.                     -i1 "popupMenuIcon.xpm" 
  2086.                     objPickMenuIcon;
  2087.             setParent ..;
  2088.  
  2089.             iconTextCheckBox -i1 "pickHandlesObj.xpm" -v 1 
  2090.                 -w $iconHeight -h $iconHeight
  2091.                 -ann "Select by object type: Handles (RMB for more info)"
  2092.                 -cc "setObjectPickMask \"Marker\" #1" objButton1;
  2093.             iconTextCheckBox -i1 "pickJointObj.xpm" -v 1 
  2094.                 -w $iconHeight -h $iconHeight
  2095.                 -ann "Select by object type: Joints (RMB for more info)"
  2096.                 -cc "setObjectPickMask \"Joint\" #1" objButton2;
  2097.             iconTextCheckBox -i1 "pickCurveObj.xpm" -v 1 
  2098.                 -w $iconHeight -h $iconHeight
  2099.                 -ann "Select by object type: Curves (RMB for more info)"
  2100.                 -cc "setObjectPickMask \"Curve\" #1" objButton3;
  2101.             iconTextCheckBox -i1 "pickGeometryObj.xpm" -v 1 
  2102.                 -w $iconHeight -h $iconHeight
  2103.                 -ann "Select by object type: Surfaces (RMB for more info)"
  2104.                 -cc "setObjectPickMask \"Surface\" #1" objButton4;
  2105.             iconTextCheckBox -i1 "pickDeformerObj.xpm" -v 1
  2106.                 -w $iconHeight -h $iconHeight
  2107.                 -ann "Select by object type: Deformations (RMB for more info)"
  2108.                 -cc "setObjectPickMask \"Deformer\" #1" objButton5;
  2109.             iconTextCheckBox -i1 "pickDynamicsObj.xpm" -v 1
  2110.                 -w $iconHeight -h $iconHeight
  2111.                 -ann "Select by object type: Dynamics (RMB for more info)"
  2112.                 -cc "setObjectPickMask \"Dynamic\" #1" objButton6;
  2113.             iconTextCheckBox -i1 "pickRenderingObj.xpm" -v 1 
  2114.                 -w $iconHeight -h $iconHeight
  2115.                 -ann "Select by object type: Rendering (RMB for more info)"
  2116.                 -cc "setObjectPickMask \"Rendering\" #1" objButton7;
  2117.             iconTextCheckBox -i1 "pickOtherObj.xpm" -v 1 
  2118.                 -w $iconHeight -h $iconHeight
  2119.                 -ann "Select by object type: Miscellaneous (RMB for more info)"
  2120.                 -cc "setObjectPickMask \"Other\" #1" objButton8;
  2121.         setParent ..;
  2122.  
  2123.         popupMenu -b 3 -p objButton1 
  2124.             -pmc "createMaskPopup \"objMarker\""
  2125.             objMarkerPopup;
  2126.         popupMenu -b 3 -p objButton2 
  2127.             -pmc "createMaskPopup \"objJoint\""
  2128.             objJointPopup;
  2129.         popupMenu -b 3 -p objButton3 
  2130.             -pmc "createMaskPopup \"objCurve\""
  2131.             objCurvePopup;
  2132.         popupMenu -b 3 -p objButton4 
  2133.             -pmc "createMaskPopup \"objSurface\""
  2134.             objSurfacePopup;
  2135.         popupMenu -b 3 -p objButton5 
  2136.             -pmc "createMaskPopup \"objDeformer\""
  2137.             objDeformerPopup;
  2138.         popupMenu -b 3 -p objButton6 
  2139.             -pmc "createMaskPopup \"objDynamic\""
  2140.             objDynamicPopup;
  2141.         popupMenu -b 3 -p objButton7 
  2142.             -pmc "createMaskPopup \"objRendering\""
  2143.             objRenderingPopup;
  2144.         popupMenu -b 3 -p objButton8 
  2145.             -pmc "createMaskPopup \"objOther\""
  2146.             objOtherPopup;
  2147.  
  2148.         // Layout the icons, by attaching them to themselves
  2149.         // and the formLayout holding the icons
  2150.         //
  2151.         formLayout -e 
  2152.         
  2153.             -af objButton8 top    0
  2154.             -an objButton8 left
  2155.             -af objButton8 bottom 0
  2156.             -af objButton8 right  0
  2157.  
  2158.             -af objButton7 top    0
  2159.             -an objButton7 left
  2160.             -af objButton7 bottom 0
  2161.             -ac objButton7 right  0 objButton8
  2162.  
  2163.             -af objButton6 top    0
  2164.             -an objButton6 left
  2165.             -af objButton6 bottom 0
  2166.             -ac objButton6 right  0 objButton7
  2167.  
  2168.             -af objButton5 top    0
  2169.             -an objButton5 left
  2170.             -af objButton5 bottom 0
  2171.             -ac objButton5 right  0 objButton6
  2172.  
  2173.             -af objButton4 top    0
  2174.             -an objButton4 left
  2175.             -af objButton4 bottom 0
  2176.             -ac objButton4 right  0 objButton5
  2177.  
  2178.             -af objButton3 top    0
  2179.             -an objButton3 left
  2180.             -af objButton3 bottom 0
  2181.             -ac objButton3 right  0 objButton4
  2182.  
  2183.             -af objButton2 top    0
  2184.             -an objButton2 left
  2185.             -af objButton2 bottom 0
  2186.             -ac objButton2 right  0 objButton3
  2187.  
  2188.             -af objButton1 top    0
  2189.             -an objButton1 left
  2190.             -af objButton1 bottom 0
  2191.             -ac objButton1 right  0 objButton2
  2192.  
  2193.             -af objPickMenuLayout top    0
  2194.             -an objPickMenuLayout left
  2195.             -an objPickMenuLayout bottom
  2196.             -ac objPickMenuLayout right  3 objButton1
  2197.  
  2198.             objectMaskIcons;
  2199.  
  2200.         // Create the icons to specify the component mode pick mask
  2201.         // in a coarser manner than the pick mask menus.
  2202.         //
  2203.         formLayout -manage $isComponent componentMaskIcons;
  2204.  
  2205.             formLayout compPickMenuLayout;
  2206.                 iconTextStaticLabel 
  2207.                     -w $thinIconWidth -h $iconHeight            
  2208.                     -annotation "Set the component selection mask"
  2209.                     -i1 "popupMenuIcon.xpm" 
  2210.                     compPickMenuIcon;
  2211.             setParent ..;
  2212.  
  2213.             iconTextCheckBox -i1 "pickPointComp2.xpm" -v 0
  2214.                 -w $iconHeight -h $iconHeight
  2215.                 -ann "Select by component type: Points (RMB for more info)"
  2216.                 -cc "setComponentPickMask \"Point\" #1" compButton1;
  2217.             iconTextCheckBox -i1 "pickPointComp.xpm" -v 0
  2218.                 -w $iconHeight -h $iconHeight
  2219.                 -ann "Select by component type: Parm Points (RMB for more info)"
  2220.                 -cc "setComponentPickMask \"ParmPoint\" #1" compButton2;
  2221.             iconTextCheckBox -i1 "pickLineComp.xpm" -v 0
  2222.                 -w $iconHeight -h $iconHeight
  2223.                 -ann "Select by component type: Lines (RMB for more info)"
  2224.                 -cc "setComponentPickMask \"Line\" #1" compButton3;
  2225.             iconTextCheckBox -i1 "pickFacetComp.xpm" -v 0
  2226.                 -w $iconHeight -h $iconHeight
  2227.                 -ann "Select by component type: Faces (RMB for more info)"
  2228.                 -cc "setComponentPickMask \"Facet\" #1" compButton4;
  2229.             iconTextCheckBox -i1 "pickHullComp.xpm" -v 0
  2230.                 -w $iconHeight -h $iconHeight
  2231.                 -ann "Select by component type: Hulls (RMB for more info)"
  2232.                 -cc "setComponentPickMask \"Hull\" #1" compButton5;
  2233.             iconTextCheckBox -i1 "pickPivotComp.xpm" -v 0
  2234.                 -w $iconHeight -h $iconHeight
  2235.                 -ann "Select by component type: Pivots (RMB for more info)"
  2236.                 -cc "setComponentPickMask \"Pivot\" #1" compButton6;
  2237.             iconTextCheckBox -i1 "pickHandlesComp.xpm" -v 0
  2238.                 -w $iconHeight -h $iconHeight
  2239.                 -ann "Select by component type: Handles (RMB for more info)"
  2240.                 -cc "setComponentPickMask \"Marker\" #1" compButton7;
  2241.             iconTextCheckBox -i1 "pickOtherComp.xpm" -v 0
  2242.                 -w $iconHeight -h $iconHeight
  2243.                 -ann "Select by component type: Miscellaneous (RMB for more info)"
  2244.                 -cc "setComponentPickMask \"Other\" #1" compButton8;
  2245.         setParent ..;
  2246.  
  2247.         popupMenu -b 3 -p compButton1 
  2248.             -pmc "createMaskPopup \"compPoint\""
  2249.             compPointPopup;
  2250.         popupMenu -b 3 -p compButton2
  2251.             -pmc "createMaskPopup \"compParmPoint\""
  2252.             compParmPointPopup;
  2253.         popupMenu -b 3 -p compButton3
  2254.             -pmc "createMaskPopup \"compLine\""
  2255.             compLinePopup;
  2256.         popupMenu -b 3 -p compButton4
  2257.             -pmc "createMaskPopup \"compFacet\""
  2258.             compFacetPopup;
  2259.         popupMenu -b 3 -p compButton5
  2260.             -pmc "createMaskPopup \"compHull\""
  2261.             compHullPopup;
  2262.         popupMenu -b 3 -p compButton6
  2263.             -pmc "createMaskPopup \"compPivot\""
  2264.             compPivotPopup;
  2265.         popupMenu -b 3 -p compButton7
  2266.             -pmc "createMaskPopup \"compMarker\""
  2267.             compMarkerPopup;
  2268.         popupMenu -b 3 -p compButton8
  2269.             -pmc "createMaskPopup \"compOther\""
  2270.             compOtherPopup;
  2271.  
  2272.         // Layout the icons, by attaching them to themselves
  2273.         // and the formLayout holding the icons
  2274.         //
  2275.         formLayout -e 
  2276.     
  2277.             -af compButton8 right 0
  2278.             -ac compButton7 right 0 compButton8
  2279.             -ac compButton6 right 0 compButton7
  2280.             -ac compButton5 right 0 compButton6
  2281.             -ac compButton4 right 0 compButton5
  2282.             -ac compButton3 right 0 compButton4
  2283.             -ac compButton2 right 0 compButton3
  2284.             -ac compButton1 right 0 compButton2
  2285.             -ac compPickMenuLayout right 2 compButton1
  2286.  
  2287.             componentMaskIcons;
  2288.  
  2289.         setParent ..; 
  2290.  
  2291.         formLayout -edit 
  2292.             -an selectMaskSeparator top
  2293.             -af selectMaskSeparator left 0
  2294.             -af selectMaskSeparator bottom 0 
  2295.             -af selectMaskSeparator right 0
  2296.  
  2297.             -af comboSelectText top 0
  2298.             -af comboSelectText left 0
  2299.             -ac comboSelectText bottom 0 selectMaskSeparator
  2300.             -an comboSelectText right
  2301.  
  2302.             -af hierarchyIcons top 0
  2303.             -af hierarchyIcons left 0
  2304.             -ac hierarchyIcons bottom 0 selectMaskSeparator
  2305.             -an hierarchyIcons right
  2306.  
  2307.             -af objectMaskIcons top 0
  2308.             -af objectMaskIcons left 0
  2309.             -ac objectMaskIcons bottom 0 selectMaskSeparator
  2310.             -an objectMaskIcons right
  2311.  
  2312.             -af componentMaskIcons top 0
  2313.             -af componentMaskIcons left 0
  2314.             -ac componentMaskIcons bottom 0 selectMaskSeparator
  2315.             -an componentMaskIcons right
  2316.  
  2317.             selectMaskForm;
  2318.  
  2319.         // Create the icons to specify the snapping
  2320.         //
  2321.         formLayout -vis 1 snapIcons;
  2322.             iconTextCheckBox 
  2323.                 -i1 "snapCurve.xpm" 
  2324.                 -w $iconHeight -h $iconHeight
  2325.                 -v 0
  2326.                 -cc "snapMode -curve #1" 
  2327.                 -ann "Snap to curves" 
  2328.                 snapButton1;
  2329.             iconTextCheckBox 
  2330.                 -i1 "snapPoint.xpm" 
  2331.                 -w $iconHeight -h $iconHeight
  2332.                 -v 0
  2333.                 -cc "snapMode -point #1" 
  2334.                 -ann "Snap to points" 
  2335.                 snapButton3;
  2336.             iconTextCheckBox 
  2337.                 -i1 "snapGrid.xpm"
  2338.                 -w $iconHeight -h $iconHeight
  2339.                 -v 0
  2340.                 -cc "snapMode -grid #1" 
  2341.                 -ann "Snap to grids" 
  2342.                 snapButton4;
  2343.             iconTextCheckBox 
  2344.                 -i1 "snapPlane.xpm" 
  2345.                 -w $iconHeight -h $iconHeight
  2346.                 -v 0
  2347.                 -cc "snapMode -viewPlane #1" 
  2348.                 -ann "Snap to view planes" 
  2349.                 snapButton6;
  2350.             //
  2351.             //    Create a "make live" button
  2352.             //
  2353.             iconTextButton
  2354.                 -image1 "makeLiveIcon.xpm"
  2355.                 -width $height -height $height
  2356.                 -command ("MakeLive")
  2357.                 -annotation "Make the selected object live"
  2358.                 makeLiveButton;
  2359.         setParent ..;
  2360.  
  2361.         // Layout the icons, by attaching them to themselves
  2362.         // and the formLayout holding the icons
  2363.         //
  2364.         formLayout -e 
  2365. //            -af snapButton7 right 0
  2366.             -af makeLiveButton right 0
  2367.             -ac snapButton6 right 0 makeLiveButton
  2368. //            -ac snapButton5 right 0 snapButton6
  2369. //            -ac snapButton4 right 0 snapButton5
  2370. //            -ac snapButton2 right 0 snapButton6
  2371.             -ac snapButton3 right 0 snapButton6
  2372.             -ac snapButton1 right 0 snapButton3
  2373.             -ac snapButton4 right 0 snapButton1
  2374.             snapIcons;
  2375.  
  2376.         // Create the history button and popup
  2377.         //
  2378.         formLayout historyLayout;
  2379.  
  2380.             //    Place both of the symbol buttons in a form layout so that
  2381.             //    the popup menu can be attached to the form instead of the
  2382.             //    button.  This will prevent the button from looking like it's
  2383.             //    still pressed after the popup menu is accessed.
  2384.             //
  2385.             string $historyForm = `formLayout`;
  2386.             iconTextButton 
  2387.                 -w $iconHeight -h $iconHeight             
  2388.                 -annotation "Inputs to the selected object"
  2389.                 -i1 "historyPulldownIcon.xpm" historyIcon;
  2390.             setParent ..;
  2391.             string $futureForm = `formLayout`;
  2392.             iconTextButton
  2393.                 -w $iconHeight -h $iconHeight             
  2394.                 -annotation "Outputs from the selected object"
  2395.                 -i1 "futurePulldownIcon.xpm" futureIcon;
  2396.             setParent ..;
  2397.             iconTextCheckBox -i1 "constructionHistoryOn.xpm" -v 0
  2398.                 -w $iconHeight -h $iconHeight
  2399.                 -ann "Construction History On/Off"
  2400.                 -cc "constructionHistory -toggle #1" 
  2401.                 constructionHistoryButton;
  2402.             updateConstructionHistory;
  2403.         setParent ..;
  2404.  
  2405.         formLayout -e
  2406.             -af $historyForm left 0
  2407.             -af $historyForm top 0
  2408.             -af $historyForm bottom 0 
  2409.  
  2410.             -ac $futureForm left 0 $historyForm
  2411.             -af $futureForm top 0
  2412.             -af $futureForm bottom 0 
  2413.  
  2414.             -ac constructionHistoryButton left 0 $futureForm
  2415.             -af constructionHistoryButton top 0
  2416.  
  2417.             historyLayout;
  2418.  
  2419.         popupMenu -b 1 -p $historyForm -pmc "createHistoryPopup"
  2420.             -aob true  historyPopup;
  2421.         popupMenu -b 1 -p $futureForm -pmc "createFuturePopup"
  2422.             -aob true futurePopup;
  2423.  
  2424.         // 
  2425.         // Create the rendering icons
  2426.         //
  2427.         iconTextButton
  2428.             -image1 "rvRender.xpm" 
  2429.             -width $iconHeight -height $iconHeight
  2430.             -command ("RenderIntoNewWindow")
  2431.             -annotation "Render the current frame"
  2432.             renderButton;
  2433.  
  2434.         iconTextButton 
  2435.             -image1 "rvIprRender.xpm" 
  2436.             -width $iconHeight -height $iconHeight
  2437.             -command ("IPRRenderIntoNewWindow")
  2438.             -annotation "IPR render the current frame"
  2439.             iprRenderButton;
  2440.  
  2441.         iconTextButton 
  2442.             -image1 "rvRenderGlobals.xpm" 
  2443.             -width $iconHeight -height $iconHeight
  2444.             -command ("displayRenderGlobalsWindow")
  2445.             -annotation "Display Render Globals window"
  2446.             renderGlobalsButton;
  2447.  
  2448.         //
  2449.         // Create the selection field
  2450.         //
  2451.         iconTextButton 
  2452.             -i1 "quickSelect.xpm" 
  2453.             -w 30 -h $iconHeight
  2454.             -annotation "Set the field entry mode"
  2455.             statusFieldButton;
  2456.  
  2457.         $gNumericalInputField = `textField -w 84
  2458.             -ann "Type text with wildcards to select objects"
  2459.             -cc "quickWildcardSelect"`; 
  2460.  
  2461.         //    Attach script jobs to the input field to catch object rename  
  2462.         //    and selection change events.
  2463.         //
  2464.         scriptJob -parent $gNumericalInputField
  2465.             -event "SelectionChanged" ("statusLineUpdateInputField");
  2466.         scriptJob -parent $gNumericalInputField
  2467.             -event "NameChanged" ("statusLineUpdateInputField");
  2468.         
  2469.         // Put a menu on the button to change modes
  2470.         string $menu = `popupMenu -b 1 -p statusFieldButton`;
  2471.             menuItem -l "Quick Selection" -c "setQuickFieldMode Select";
  2472.             menuItem -l "Quick Rename" -c "setQuickFieldMode Rename";
  2473.             menuItem -l "Numeric Input: Absolute" -c "setQuickFieldMode Abs";
  2474.             menuItem -l "Numeric Input: Relative" -c "setQuickFieldMode Rel";
  2475.         setParent -m ..;
  2476.  
  2477.         // Put the same menu on the field as a shortcut
  2478.         string $menu = `popupMenu -b 3 -p $gNumericalInputField`;
  2479.             menuItem -l "Quick Selection" -c "setQuickFieldMode Select";
  2480.             menuItem -l "Quick Rename" -c "setQuickFieldMode Rename";
  2481.             menuItem -l "Numeric Input: Absolute" -c "setQuickFieldMode Abs";
  2482.             menuItem -l "Numeric Input: Relative" -c "setQuickFieldMode Rel";
  2483.         setParent -m ..;
  2484.  
  2485.         // Lock selection button icon
  2486.         //
  2487.         iconTextCheckBox -v 0
  2488.             -enable true
  2489.             -i1 "lock.xpm"
  2490.             -w $iconHeight -h $iconHeight
  2491.             -ann "Lock/unlock current selection"
  2492.             -cc "updateLockSelectionIcon"
  2493.             lockSelectionIcon;
  2494.  
  2495.         iconTextCheckBox -v 0
  2496.             -enable true
  2497. //            -i1 "highlightSelectOn.xpm"
  2498.             -w $iconHeight -h $iconHeight
  2499. //            -ann "Toggle Highlight Select mode"
  2500.             -cc "toggleHighlightSelectIcon"
  2501.             highlightSelectIcon;
  2502.  
  2503.         // Create the expand/collapse button separators
  2504.         //
  2505.         if (!`optionVar -exists "showStatusFiles"`) {
  2506.             optionVar -intValue "showStatusFiles" 1;
  2507.         }
  2508.         iconTextButton -vis true -h 27 -w 9 
  2509.             -ann "Show/hide the file icons"
  2510.             -i1 openBar.xpm  
  2511.             -c ("toggleFileIcons(-1)")
  2512.             fileCollapse;
  2513.  
  2514.         // Default this one off since it is infrequently used
  2515.         if (!`optionVar -exists "showStatusSelectionSet"`) {
  2516.             optionVar -intValue "showStatusSelectionSet" 0;
  2517.         }
  2518.         iconTextButton -vis true -h 27 -w 9  
  2519.             -ann "Show/hide the selection set icons"
  2520.             -i1 openBar.xpm  -c ("toggleSelectionSetIcons(-1)")
  2521.             selectionSetCollapse;
  2522.  
  2523.         if (!`optionVar -exists "showStatusSelectMode"`) {
  2524.             optionVar -intValue "showStatusSelectMode" 1;
  2525.         }
  2526.         iconTextButton -vis true -h 27 -w 9  
  2527.             -ann "Show/hide the selection mode icons"
  2528.             -i1 openBar.xpm  -c ("toggleSelectModeIcons(-1)")
  2529.             selectModeCollapse;
  2530.  
  2531.         if (!`optionVar -exists "showStatusSelectMasks"`) {
  2532.             optionVar -intValue "showStatusSelectMasks" 1;
  2533.         }
  2534.         iconTextButton -vis true -h 27 -w 9  
  2535.             -ann "Show/hide the selection mask icons"
  2536.             -i1 openBar.xpm  -c ("toggleSelectMaskIcons(-1)")
  2537.             selectMasksCollapse;
  2538.  
  2539.         if (!`optionVar -exists "showStatusSnap"`) {
  2540.             optionVar -intValue "showStatusSnap" 1;
  2541.         }
  2542.         iconTextButton -vis true -h 27 -w 9
  2543.             -ann "Show/hide the snap icons"
  2544.             -i1 openBar.xpm  -c ("toggleSnapIcons(-1)")
  2545.             snapCollapse;
  2546.  
  2547.         if (!`optionVar -exists "showStatusHistory"`) {
  2548.             optionVar -intValue "showStatusHistory" 1;
  2549.         }
  2550.         iconTextButton -vis true -h 27 -w 9
  2551.             -ann "Show/hide the history icons"
  2552.             -i1 openBar.xpm  -c ("toggleHistoryIcons(-1)")
  2553.             historyCollapse;
  2554.  
  2555.         if (!`optionVar -exists "showStatusRender"`) {
  2556.             optionVar -intValue "showStatusRender" 1;
  2557.         }
  2558.         iconTextButton -vis true -h 27 -w 9
  2559.             -ann "Show/hide the rendering icons"
  2560.             -i1 openBar.xpm  -c ("toggleRenderIcons(-1)")
  2561.             renderCollapse;
  2562.  
  2563.         if (!`optionVar -exists "showStatusInputField"`) {
  2564.             optionVar -intValue "showStatusInputField" 1;
  2565.         }
  2566.         iconTextButton -vis true -h 27 -w 9
  2567.             -ann "Show/hide the select field"
  2568.             -i1 openBar.xpm  -c ("toggleInputField(-1)")
  2569.             inputFieldCollapse;
  2570.  
  2571.         // Set up the overall formLayout that controls the
  2572.         // layout of the various parts of the infoBar
  2573.         //
  2574.         int $edging = 2; 
  2575.         int $margin = 1;
  2576.  
  2577.         //    Fix up the spacing before the Menu Mode option menu. Borders around
  2578.         //    option menus are different across platforms. Add a couple pixels
  2579.         //    to NT to make the Status Line align better with the Shelf below it.
  2580.         //
  2581.         int $menuModeSpace = 0;
  2582.         if (`about -nt`) {
  2583.             $menuModeSpace = 2;
  2584.         }
  2585.  
  2586.         formLayout -edit
  2587.             -attachForm    menuMode               top     $margin
  2588.             -attachForm    menuMode               left    $menuModeSpace
  2589.             -attachNone    menuMode               bottom
  2590.             -attachNone    menuMode               right
  2591.  
  2592.             -attachForm    fileCollapse           top     $margin
  2593.             -attachControl fileCollapse           left    $edging menuMode
  2594.             -attachNone    fileCollapse           bottom
  2595.             -attachNone    fileCollapse           right
  2596.  
  2597.             -attachForm    newSceneButton         top     $margin
  2598.             -attachControl newSceneButton         left    $edging fileCollapse
  2599.             -attachNone    newSceneButton         bottom
  2600.             -attachNone    newSceneButton         right
  2601.  
  2602.             -attachForm    openSceneButton        top     $margin
  2603.             -attachControl openSceneButton        left    $edging newSceneButton
  2604.             -attachNone    openSceneButton        bottom
  2605.             -attachNone    openSceneButton        right
  2606.  
  2607.             -attachForm    saveSceneButton        top     $margin
  2608.             -attachControl saveSceneButton        left    $edging openSceneButton
  2609.             -attachNone    saveSceneButton        bottom
  2610.             -attachNone    saveSceneButton        right
  2611.  
  2612.             -attachForm    selectionSetCollapse   top     $margin
  2613.             -attachControl selectionSetCollapse   left    $edging saveSceneButton
  2614.             -attachNone    selectionSetCollapse   bottom
  2615.             -attachNone    selectionSetCollapse   right
  2616.  
  2617.             -attachForm    presetForm             top     $margin
  2618.             -attachControl presetForm             left    $edging selectionSetCollapse
  2619.             -attachNone    presetForm             bottom
  2620.             -attachNone    presetForm             right
  2621.  
  2622.             -attachForm    selectModeCollapse     top     $margin
  2623.             -attachControl selectModeCollapse     left    $edging presetForm
  2624.             -attachNone    selectModeCollapse     bottom
  2625.             -attachNone    selectModeCollapse     right
  2626.  
  2627.             -attachForm    masksForm              top     $margin
  2628.             -attachControl masksForm              left    $edging selectModeCollapse
  2629.             -attachNone    masksForm              bottom
  2630.             -attachNone    masksForm              right
  2631.  
  2632.             -attachForm    selectMasksCollapse    top     $margin
  2633.             -attachControl selectMasksCollapse    left    $edging masksForm
  2634.             -attachNone    selectMasksCollapse    bottom
  2635.             -attachNone    selectMasksCollapse    right
  2636.  
  2637.             -attachForm    selectMaskForm         top     $margin
  2638.             -attachControl selectMaskForm         left    $edging selectMasksCollapse
  2639.             -attachNone    selectMaskForm         bottom
  2640.             -attachNone    selectMaskForm         right
  2641.  
  2642.             -attachForm    lockSelectionIcon      top     $margin
  2643.             -attachControl lockSelectionIcon      left    0 selectMaskForm
  2644.             -attachNone    lockSelectionIcon      bottom
  2645.             -attachNone    lockSelectionIcon      right
  2646.  
  2647.             -attachForm    highlightSelectIcon    top     $margin
  2648.             -attachControl highlightSelectIcon    left    0 lockSelectionIcon
  2649.             -attachNone    highlightSelectIcon    bottom
  2650.             -attachNone    highlightSelectIcon    right
  2651.  
  2652.             -attachForm    snapCollapse           top     $margin
  2653.             -attachControl snapCollapse           left    $edging highlightSelectIcon
  2654.             -attachNone    snapCollapse           bottom
  2655.             -attachNone    snapCollapse           right
  2656.  
  2657.             -attachForm    snapIcons              top     $margin
  2658.             -attachControl snapIcons              left    $edging snapCollapse
  2659.             -attachNone    snapIcons              bottom
  2660.             -attachNone    snapIcons              right
  2661.  
  2662.             -attachForm    historyCollapse        top     $margin
  2663.             -attachControl historyCollapse        left    $edging snapIcons
  2664.             -attachNone    historyCollapse        bottom
  2665.             -attachNone    historyCollapse        right
  2666.  
  2667.             -attachForm    historyLayout          top     $margin
  2668.             -attachControl historyLayout          left    $edging historyCollapse
  2669.             -attachNone    historyLayout          bottom
  2670.             -attachNone    historyLayout          right
  2671.  
  2672.             -attachForm    renderCollapse         top     $margin
  2673.             -attachControl renderCollapse         left    $edging historyLayout
  2674.             -attachNone    renderCollapse         bottom
  2675.             -attachNone    renderCollapse         right
  2676.  
  2677.             -attachForm    renderButton           top     $margin
  2678.             -attachControl renderButton           left    $edging renderCollapse
  2679.             -attachNone    renderButton           bottom
  2680.             -attachNone    renderButton           right
  2681.  
  2682.             -attachForm    iprRenderButton        top     $margin
  2683.             -attachControl iprRenderButton        left    $edging renderButton
  2684.             -attachNone    iprRenderButton        bottom
  2685.             -attachNone    iprRenderButton        right
  2686.  
  2687.             -attachForm    renderGlobalsButton    top     $margin
  2688.             -attachControl renderGlobalsButton    left    $edging iprRenderButton
  2689.             -attachNone    renderGlobalsButton    bottom
  2690.             -attachNone    renderGlobalsButton    right
  2691.  
  2692.             -attachForm    inputFieldCollapse     top     $margin
  2693.             -attachControl inputFieldCollapse     left    $edging renderGlobalsButton
  2694.             -attachNone    inputFieldCollapse     bottom
  2695.             -attachNone    inputFieldCollapse     right
  2696.  
  2697.             -attachForm    statusFieldButton      top     $margin
  2698.             -attachControl statusFieldButton      left    $edging inputFieldCollapse
  2699.             -attachNone    statusFieldButton      bottom
  2700.             -attachNone    statusFieldButton      right
  2701.  
  2702.             -attachForm    $gNumericalInputField  top     $margin
  2703.             -attachControl $gNumericalInputField  left    $edging statusFieldButton
  2704.             -attachForm    $gNumericalInputField  bottom  0
  2705.             -attachNone    $gNumericalInputField  right
  2706.             $gStatusLine;
  2707.  
  2708.         //    Create the visibility buttons for the Attribute Editor,
  2709.         //    Tool Settings, and Channel Box / Layer Editor.
  2710.         //
  2711.         setParent $statusLine;
  2712.         $buttonForm = `formLayout`;
  2713.  
  2714.         //    Now the buttons.
  2715.         //
  2716.         $attributeEditorButton = `iconTextButton -image1 "attributes.xpm"
  2717.             -width $iconHeight -height $iconHeight
  2718.             -annotation ("Show or hide the Attribute Editor")
  2719.             -command ("ToggleAttributeEditor")`;
  2720.  
  2721.         $toolSettingsButton = `iconTextButton -image1 "toolSettings.xpm"
  2722.             -width $iconHeight -height $iconHeight
  2723.             -annotation ("Show or hide the Tool Settings")
  2724.             -command ("ToggleToolSettings")`;
  2725.  
  2726.         $channelBoxLayerEditorButton = `iconTextButton -image1 "channelsLayers.xpm"
  2727.             -width $iconHeight -height $iconHeight
  2728.             -annotation ("Show or hide the Channel Box / Layer Editor")
  2729.             -command ("ToggleChannelsLayers")`;
  2730.  
  2731.         //    Set up the attachments.
  2732.         //
  2733.         formLayout -edit
  2734.             -attachForm    $attributeEditorButton        top    $margin
  2735.             -attachForm    $attributeEditorButton        left   0
  2736.             -attachNone    $attributeEditorButton        bottom
  2737.             -attachNone    $attributeEditorButton        right
  2738.  
  2739.             -attachForm    $toolSettingsButton           top    $margin
  2740.             -attachControl $toolSettingsButton           left   0 $attributeEditorButton
  2741.             -attachNone    $toolSettingsButton           bottom
  2742.             -attachNone    $toolSettingsButton           right
  2743.  
  2744.             -attachForm    $channelBoxLayerEditorButton  top    $margin
  2745.             -attachControl $channelBoxLayerEditorButton  left   0 $toolSettingsButton
  2746.             -attachNone    $channelBoxLayerEditorButton  bottom
  2747.             -attachNone    $channelBoxLayerEditorButton  right
  2748.             $buttonForm;
  2749.         
  2750.         //    Attachemnts for the Status Line and the new visibility buttons.
  2751.         //
  2752.         //    Note that the layout is set up this way so that the buttons
  2753.         //    will always be visible even if the main Maya window is not 
  2754.         //    wide enough to show all the original Status Line controls.
  2755.         //
  2756.         formLayout -edit
  2757.             -attachForm    $gStatusLine  top    0
  2758.             -attachForm    $gStatusLine  left   0
  2759.             -attachForm    $gStatusLine  bottom 0
  2760.             -attachControl $gStatusLine  right  0 $buttonForm
  2761.  
  2762.             -attachForm    $buttonForm   top    0
  2763.             -attachNone    $buttonForm   left
  2764.             -attachForm    $buttonForm   bottom 0
  2765.             -attachForm    $buttonForm   right  0
  2766.             $statusLine;
  2767.  
  2768.     toggleFileIcons(`optionVar -q showStatusFiles`);
  2769.     toggleSelectionSetIcons(`optionVar -q showStatusSelectionSet`);
  2770.     toggleSelectModeIcons(`optionVar -q showStatusSelectMode`);
  2771.     toggleSelectMaskIcons(`optionVar -q showStatusSelectMasks`);
  2772.     toggleSnapIcons(`optionVar -q showStatusSnap`);
  2773.     toggleHistoryIcons(`optionVar -q showStatusHistory`);
  2774.     toggleRenderIcons(`optionVar -q showStatusRender`);
  2775.     toggleInputField(`optionVar -q showStatusInputField`);
  2776.     
  2777.     // Add popupMenus to the infoBar layout
  2778.     //    
  2779.     ObjectMaskPopup objPickMenuLayout;
  2780.     ComponentMaskPopup compPickMenuLayout;
  2781.  
  2782.     // Setup conditions to run when the selection mask
  2783.     // changes, to keep the icons on the toolbar in sync
  2784.     // with the current selection mask settings.
  2785.     //
  2786.     scriptJob -permanent -parent $gStatusLine -event "SelectModeChanged" 
  2787.         updateSelectionModeIcons;
  2788.     scriptJob -permanent -parent $gStatusLine -event "SelectTypeChanged" 
  2789.         updateObjectSelectionMasks;
  2790.     scriptJob -permanent -parent $gStatusLine -event "SelectTypeChanged" 
  2791.         updateComponentSelectionMasks;
  2792.     scriptJob -permanent -parent $gStatusLine -event "snapModeChanged" 
  2793.         updateSnapMasks;
  2794.     scriptJob -permanent -parent $gStatusLine -event "constructionHistoryChanged" 
  2795.         updateConstructionHistory;
  2796.     scriptJob -permanent -parent $gStatusLine -event "SelectPreferenceChanged"
  2797.         "iconTextCheckBox -e -v `selectPref -q -xformNoSelect` lockSelectionIcon";
  2798.     scriptJob -permanent -parent $gStatusLine -event "SelectPreferenceChanged"
  2799.         "updateHighlightSelectIcon";
  2800.  
  2801.     // Run the above events now, to ensure that the icons
  2802.     // are in sync upon Maya's startup
  2803.     //
  2804.     updateObjectSelectionMasks;
  2805.     updateComponentSelectionMasks;
  2806.     updateSnapMasks;
  2807.     updateHighlightSelectIcon;
  2808.  
  2809.     //    Attach Status line to parent.
  2810.     //
  2811.     formLayout -edit
  2812.         -attachForm $statusLine "top"    0
  2813.         -attachForm $statusLine "left"   0
  2814.         -attachForm $statusLine "bottom" 0
  2815.         -attachForm $statusLine "right"  0
  2816.         $gStatusLineForm;
  2817.  
  2818.     setUIComponentStateCallback(
  2819.         "Status Line", "statusLineVisibilityStateChange");
  2820.  
  2821.     updateStatusLineRendererSpecificUI();
  2822. }
  2823.  
  2824. global proc int statusLineVisibilityStateChange(
  2825.     int    $newState,
  2826.     string $layout)
  2827. //
  2828. //    Description:
  2829. //        This procedure is called whenever the visibility state of the 
  2830. //        Status Line is changed.
  2831. //
  2832. //    Arguments:
  2833. //        newState - The new visibile state of the Status Line.
  2834. //
  2835. //        layout - The parent layout for the Status Line.
  2836. //
  2837. //    Returns:
  2838. //        true - If the change of state is to be allowed.
  2839. //
  2840. //        false - If the state change is rejected.
  2841. //
  2842. {
  2843.     int $result = true;
  2844.  
  2845.     //    Defer these commands because this proc is called when the visibility
  2846.     //    state is about to change. This proc must return true to accept 
  2847.     //    the state change. After this proc returns then restore the
  2848.     //    panel focus and update the pref menu.
  2849.     //
  2850.     evalDeferred("restoreLastPanelWithFocus(); updatePrefsMenu();");
  2851.  
  2852.     return $result;
  2853. }
  2854.